在 Julia REPL 中,我想运行一些终端命令,但不一定希望通过管道或其他语法来包装系统调用。有没有更本地化的方式从 REPL 运行终端命令?
Julia的 REPL 拥有所谓的Shell模式。您可以通过在终端中键入 ;
来访问 Shell 模式,结果如下:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.0 (2021-03-24)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
shell>
你可以运行类似以下的命令:
shell> pwd
/Users/my_username
shell>
在这里阅读有关Shell模式的更多信息:https://docs.julialang.org/en/v1/stdlib/REPL/#man-shell-mode