Thursday, March 17, 2011

Shell Poetry

If in script.sh you want to
echo err >/dev/stderr
then you should
echo err >>/dev/stderr
unless you plan to catch
only the last message
when running
script.sh 2>err.log

Forget all the above,
despite it works in many cases.
In fact, the only correct form is
echo err 1>&2