4 ms·
That's a bit of a tradeoff though. If you expect that backticks pass things to the shell unchanged, like Perl does, you know what's happening. And as you ment
by tyingq 3y ago
That's a bit of a tradeoff though. If you expect that backticks pass things to the shell unchanged, like Perl does, you know what's happening. And as you mention, Perl offers other ways to skip passing to the shell and set args directly.
Julia's approach of parsing things in backticks does remove some footguns, but it also means you have to do things like this:
julia> run(`echo hello \| sort`);
Else the pipe character is interpreted as a plain argument.
- sundarurfriend 3y agoThat just echoes "hello | sort", the backtick execution in Julia is only for single commands. For pipelines, there's the `pipeline` function, like so: run(pipeline(`echo hello`, `sort`))
- tyingq 3y agoAh, yeah, I had misread the docs there. Though I imagine it creates that unexpected for beginner's thing where `ls | sort` comes back with "no such file |" or similar. Basically, I'm saying there is a place for an interface that does pass a single string to the shell, and an interface where you specify args explicitly.