tee and some commands

Robert P. J. Day rpjday at crashcourse.ca
Tue Mar 22 13:29:08 UTC 2011


On Tue, 22 Mar 2011, Leo "TheHobbit" Cacciari wrote:

>
>       Hi chaps
>
>        
>
>       Anyone noticed that tee doesn’t seem to log the output from some commands to a
>       log file?
>
>        
>
>       I am using tee in a script on the following line;
>
>           ncftpput -u $ftp_user -p $ftp_pass -R -m -v ftp.mydomain.local /
>       $dest/\archives/$1/ | tee -a $out_file

  it's entirely possible that what's coming out of the previous
command is being sent to stderr, whereas only stdout is passed
through a pipe by default.

  if you want both stdout and stderr to be processed by the pipe, use
the following:

  blah blah 2>&1 | going here

the "2>&1" forces stderr to follow stdout, at which point both streams
go to the pipe.

rday

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


More information about the ubuntu-users mailing list