Logging also stderr in verbose mode ?

Kjetil Torgrim Homme kjetilho at linpro.no
Tue Apr 2 16:07:17 CEST 2002


Ronan KERYELL <Ronan.Keryell at enst-bretagne.fr> writes:

> Verbose mode is great but only stdout is logged and I've spent some time
> to figure out what was happening... :-(
> 
> Well not so easy in subroutines... :
>     elif [ "$verbose" ]; then
> 	yes '' | install_packages | tee -a /tmp/software.log
>     else
> 	yes '' | install_packages >> /tmp/software.log 2>&1
>     fi
> 
> Interesting shell challenge... :-)
> Using 2 'tee -a /tmp/software.log', one for stdout and the other for
> stderr ?

Change it into

  yes '' | install_packages 2>&1 | tee -a /tmp/software.log


Kjetil T.



More information about the linux-fai mailing list