SOLVED: Redirection in bash: stdout AND stderr to file while…

Página Inicial
Anexos:
Mensagem como email
+ (text/plain)
Delete this message
Reply to this message
Autor: kitepilot@kitepilot.com
Data:  
Para: Main PLUG discussion list
Assunto: SOLVED: Redirection in bash: stdout AND stderr to file while SIMULTANEOUSLY stderr to another file.
I'm not quite sure how it works, bit it does exactly what I want... :)


srcadmin@mothership[~]$ cat /tmp/junk.sh
#!/bin/bash

echo "GOOD boy..."
echo "MORON BOY!!" >&2
#END#
srcadmin@mothership[~]$ rm -f /tmp/junk.err /tmp/junk.log
srcadmin@mothership[~]$ ((/tmp/junk.sh 3>&1 1>&2 2>&3) | tee /tmp/junk.err)
>& /tmp/junk.log

srcadmin@mothership[~]$ cat /tmp/junk.log
GOOD boy...
MORON BOY!!
srcadmin@mothership[~]$ cat /tmp/junk.err
MORON BOY!!
srcadmin@mothership[~]$
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss