Shell mode for scripts

91 views
Skip to first unread message

Lance Larsen

unread,
Feb 2, 2016, 8:44:33 AM2/2/16
to julia-users
In the julia interactive interpreter, the shell mode is very nice. I would like to be able to use julia as my main shell except for one thing. Shell mode is only available in interactive mode. Has there been discussion about having a way to enter shell mode in julia scripts. That would be awesome!

Páll Haraldsson

unread,
Feb 5, 2016, 6:41:25 PM2/5/16
to julia-users
I'm not sure I get what you mean. E.g.:

julia> run(`ls`)

does the same for me as:

shell> ls


Note the shell, isn't actually a shell.. and not exactly the same as run. Maybe they are close enough, is is it bothering you? E.g. I couldn't run two shell commands this way:

julia> run(`ls;ls`)

run(`ls;ls`)
ERROR: could not spawn `ls;ls`: no such file or directory (ENOENT)
 in _jl_spawn at process.jl:262
 in anonymous at process.jl:415
 in setup_stdio at ./process.jl:403
 in __spawn#58__ at ./process.jl:414
 in run at ./process.jl:530

shell> ls;ls

shell> env

[does what I expect, include list HOME]

shell> echo $HOME
ERROR: UndefVarError: HOME not defined

[I'm on Linux, with Julia 4.0 here.]

-- 
Palli.
Reply all
Reply to author
Forward
0 new messages