【问题标题】:How to run shell commands from the Julia REPL?如何从 Julia REPL 运行 shell 命令?
【发布时间】:2021-10-23 17:50:35
【问题描述】:

在 Julia REPL 中,我想运行一些终端命令,但不一定想通过管道或其他包含系统调用的语法来执行这些命令。有没有更原生的方式从 REPL 运行终端命令?

【问题讨论】:

    标签: julia read-eval-print-loop


    【解决方案1】:

    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

    【讨论】:

      猜你喜欢
      • 2019-03-01
      • 2020-03-31
      • 2012-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多