SOLVED: Redirection in bash: stdout AND stderr to file while SIMULTANEOUSLY stderr to another file.
kitepilot at kitepilot.com
kitepilot at kitepilot.com
Sat Jul 11 06:08:00 MST 2009
I'm not quite sure how it works, bit it does exactly what I want... :)
srcadmin at mothership[~]$ cat /tmp/junk.sh
#!/bin/bash
echo "GOOD boy..."
echo "MORON BOY!!" >&2
#END#
srcadmin at mothership[~]$ rm -f /tmp/junk.err /tmp/junk.log
srcadmin at mothership[~]$ ((/tmp/junk.sh 3>&1 1>&2 2>&3) | tee /tmp/junk.err)
>& /tmp/junk.log
srcadmin at mothership[~]$ cat /tmp/junk.log
GOOD boy...
MORON BOY!!
srcadmin at mothership[~]$ cat /tmp/junk.err
MORON BOY!!
srcadmin at mothership[~]$
More information about the PLUG-discuss
mailing list