안녕하세요! 네, Julia는 셸[1] (#footnote-731542-1) 명령을 실행할 수 있고 Pluto 노트북도 마찬가지입니다. 예를 들어 다음 코드를 넣은 셀은 Unix 계열 시스템의 디렉터리 목록 명령 ls를 실행합니다:
run(`ls`)
명령을 나타내는 Cmd 타입의 객체를 만든 다음 run으로 실행합니다. run과 Cmd 문서에는 이런 식으로 명령을 실행하는 방법에 대한 자세한 설명이 더 있습니다.
Pluto 노트북을 열면 모든 셀이 실행되고, 셀을 바꾸면 거기에 의존하는 셀도 다시 실행된다는 점에 유의하세요. 외부 셸 명령에서 이 동작이 바람직한지는 상황에 따라 다르지만, 의존성이 바뀔 때마다 그 “명령 셀”을 실행하지 않도록 할 수도 있습니다.
추신: run은 프로세스의 결과를 반환하므로 보통 출력이 보이거나, 명령이 실패하면 오류 코드가 보입니다.
실제로는 셸을 통해 실행하는 게 아니며, 아래 답글에서 설명했습니다. ↩︎ (#footnote-ref-731542-1)
영어에서 번역·원문 보기Hi! Yes, Julia can execute shell[1] (#footnote-731542-1) commands and so can a Pluto notebook, for example a cell with the following code executes Unix-like systems' directory-listing command ls:
run(`ls`)
It constructs an object with type Cmd representing the command, then executes it using run. The documentation for run and Cmd contains plenty of useful additional detail explaining how to execute commands in this way.
Be aware that opening a Pluto notebook executes every cell, and changing a cell also re-executes the cells depending on it. Whether that is desirable for external shell commands depends on your situation, though you can avoid executing that “command cell” whenever one of its dependencies changes.
PS: run returns the process result, meaning you generally see its output or error codes when the command fails.
Actually these commands don't execute through a shell, as explained in my later reply. ↩︎ (#footnote-ref-731542-1)