The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Regardign strtok() output directing to 2-D string array SankarV High Level Programming 3 04-28-2008 06:48 AM
C program Output arunviswanath High Level Programming 3 07-04-2007 10:16 PM
Error re-directing fermisoft UNIX for Advanced & Expert Users 3 09-12-2005 11:12 PM
Capture output of program to file with limited filesize spectre_240sx Shell Programming and Scripting 7 04-13-2005 02:40 PM
directing output Cynergetix UNIX for Dummies Questions & Answers 1 03-21-2002 08:59 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2008
Registered User
 

Join Date: Jun 2007
Posts: 16
Directing program output to a file

When I do

Code:
time tar cvf /dev/st0 /mnt/junk >> /root/benchlog
, I want it to put the output of the time command into the benchlog file, but it put /mnt/junk. How do I get it to put the output of the tar command?

Last edited by jeriryan87; 06-11-2008 at 12:26 PM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-11-2008
Registered User
 

Join Date: Jul 2005
Location: Oak Park, IL
Posts: 98
Quote:
Originally Posted by jeriryan87 View Post
When I do

Code:
time tar cvf /dev/st0 /mnt/junk >> /root/benchlog
, I want it to put the output of the time command into the benchlog file, but it put /mnt/junk. How do I get it to put the output of the tar command?
Code:
/bin/time tar cvf /dev/st0 /mnt/junk 2>> /root/benchlog
time may be a shell builtin so I give it the exact pathname. If you want to use a shell builtin (eg, you are using bash), do:

Code:
{ /bin/time tar cvf /dev/st0 /mnt/junk; } 2>> /root/benchlog
-mschwage
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0