vi redirtest.sh
{ plutti plitti } > plutti.log 2>&1 { pippi } > pippi.log 2>&1 { echo ciao } > ciao.txt { echo miao } > miao.txtThe command "plutti" and "plitti" don't exist, so I will have an error "./redirtest.sh: line 2: plutti: command not found ./redirtest.sh: line 2: plitti: command not found".
But only that block will be redirected to plutti.log.
Same story for pippi.log: you have 2 separate error logs for the 2 blocks of code.
So, not necessarily redirection has to be at the whole script level, or at the single statement level.... one can group several statements in a "try/catch" block, which is cool...IMHO at least, it gives more flexibility ...
No comments:
Post a Comment