Thanks Stefan, As far as I can see from the docs, the pipe |> can be used to chain commands where one would use a true pipe in the shell. So the examples like
run(`cut -d: -f3 /etc/passwd` |> `sort -n` |> `tail -n5`) do make sense to me. However, it appears that if one wants to use operators like ; && || in commands, one needs to implement the logic at the julia level. That is fine. However, I tried to cheat and used the pipe |> to chain commands even tough I do not need or want redirection to occur. For instance: run(`touch a` |> `sleep 3` |> `touch b`) This example runs, but the three commands are executed "at the same time" as I see the two files a and b appearing at the same time in the file manager. Hence I deduce that |> cannot be used to chain all king of commands. Am I right? Davide On Saturday, November 8, 2014 10:17:15 AM UTC, Stefan Karpinski wrote: > > Julia doesn't use the shell to execute commands, but parses "shell > commands" itself. Since Julia has its own control flow constructs, we don't > duplicate those at the "shell" level. See > http://julia.readthedocs.org/en/latest/manual/running-external-programs/#pipelines > > for more information. > > On Fri, Nov 7, 2014 at 9:03 PM, Davide Lasagna <lasagn...@gmail.com > <javascript:>> wrote: > >> Hi, >> >> just wondering why I cannot chain these kind of multiple commands in >> julia. >> >> Example: the command run(`mkdir $tmp && touch $file`) creates the >> directories $tmp, && touch and $file, while I only want the second part >> after && to run if first command is successful. Similarly if I use the ";" >> to create a sequence of commands, e.g. run(`mkdir $tmp; touch $file`). >> >> I could run multiple commands separately, and do the checks in julia, but >> there might be an easier way to achieve that. >> >> Davide >> >> >> >> >> >