I cannot figure out how to run the shell command “ls data/*.sol” using Julia’s backtick mechanism. The obvious
run(ls data/*.sol
)
produces
ls: data/*: No such file or directory
ERROR: failed process: Process(ls 'data/*'
, ProcessExited(1)) [1]
I cannot figure out how to run the shell command “ls data/*.sol” using Julia’s backtick mechanism. The obvious
run(ls data/*.sol
)
produces
ls: data/*: No such file or directory
ERROR: failed process: Process(ls 'data/*'
, ProcessExited(1)) [1]
Sorry, somehow the backticks didn’t make it into
run(
ls data/*.sol)
run
doesn’t run a shell unless you explicitly ask it to. Try
run(`sh -c ls data/*.sol`)
It’s really not recommended to use run(`sh -c ....`)
because it opens you up to all of the quoting problems, security holes, and general confusion of shell interpolation. See: A small package to run string as shell command - #5 by stevengj and Quoting in shell commands
You can do file globbing without the shell using
and interpolate the resulting list of files into a backtick expression.
Thanks, that’s what I was looking for.
Perhaps the section “Running External Programs” of the manual could mention the (shell) globbing issue?