Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also, if cmd fails, I believe it will execut cmd2. It also redirect the output of each command to a different file.


Sure, but executing cmd2 even if cmd1 fails is done with ;


Using ; will not work if you ran set -e before (eg.: if you're using it in a script). Perhaps more importantly, cmd1; cmd2 & will not work either, you'll need a subshell. So, you need at least: ( set +e; cmd1 ; cmd2 ) &. And there are probably other caveats. And we haven't even got to the output redirection yet.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: