tee and some commands
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 Â* Instead of logging to a log file via tee it now outputs two copies of the FTP output to the console and nothing to the log file. Â* Is there a way I can work around that or is it a limitation in the ncftpput command do you think? Â* Olly Â* Hi, This could depends from $out_file being equal to "-", then accordingly to tee documention, the output file is also stdout, thus achieving a duplication of output. -- Leo "TheHobbit" Cacciari Aliae nationes servitutem pati possunt populi romani est propria libertas -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
tee and some commands
On Tue, Mar 22, 2011 at 6:51 AM, Oliver Marshall
<Oliver.Marshall@g2support.com> wrote: > > 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 > > Instead of logging to a log file via tee it now outputs two copies of the > FTP output to the console and nothing to the log file. > > Is there a way I can work around that or is it a limitation in the ncftpput > command do you think? What's $out_file and can the user calling tee write to it? -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
tee and some commands
On Tue, Mar 22, 2011 at 3:51 AM, Oliver Marshall
<Oliver.Marshall@g2support.com> wrote: > Is there a way I can work around that or is it a limitation in the ncftpput > command do you think? The tee command creates its copies from standard input, but you may be seeing standard error from the previous commands in the pipeline. A common fix with tools like tee is just to ensure that both standard output and standard error from your command both go to the same file descriptor. Hence: foo 2>&1 | tee /tmp/bar will pipe all output through tee, not just standard output. Give it a try and see if that helps. -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
tee and some commands
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 ================================================== ======================-- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
| All times are GMT. The time now is 08:38 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.