Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run shell commands from the Julia REPL?

In the Julia REPL, I would like to run some terminal commands but don't necessarily want to do those commands via a pipe or other syntax which wraps around a system call. Is there a more native way of running terminal commands from the REPL?

like image 619
logankilpatrick Avatar asked Jan 24 '23 06:01

logankilpatrick


1 Answers

Julia's REPL has what is referred to as a Shell mode. You can access the Shell mode via typing in a ; into the terminal which will result in:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0 (2021-03-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

shell> 

you can then run commands like:

shell> pwd
/Users/my_username

shell> 

Read more about the Shell mode here: https://docs.julialang.org/en/v1/stdlib/REPL/#man-shell-mode

like image 101
logankilpatrick Avatar answered Feb 04 '23 16:02

logankilpatrick