LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-16-2006, 09:58 AM   #1
ah_kayyali
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Rep: Reputation: 0
Question tar command output redirection


hellooooooooooz
i am trying to use the tar command,, i used to use the script i made,, but one time i checked the tape and found some file not backed, i ran the script again and did nothing, just watching the output on screen, i triedto use output redirection but i can't redirect the errors only to a log file, here what i used
tar -cvf tarfile.tar f1 f2 f3 f4 f5 2>tar.log
and i found that the file tar.log holds the same output from both stdout and the stderr,,

do u have any idea about redirecting the errors only to the log file?????

thx in advance.
 
Old 03-16-2006, 10:11 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Hi,

The given command (tar -cvf tarfile.tar f1 f2 f3 f4 f5 2>tar.log) should work: Errors, if any, to tar.log and normal output to screen.

You are talking about a script, could it be that the script already redirects the output?
Does the tar command work when typed at the prompt?

Not much to go on, but I hope it helps anyway.
 
Old 03-19-2006, 02:59 AM   #3
ah_kayyali
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Exclamation

i am still having the same result even when i run the command on the prompt?, also i checked the script and found nothing redirecting the stderr to anything,,, i wish to find a solution
 
Old 03-19-2006, 06:02 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Scanning man tar did not give an answer, but here is a GUESS:
The substantive output of tar goes to the specified file---not to "stdout". Thus, the only thing that I would expect to go to stdout would be errors.
What happens if you explicity send stdout to one file, and stderr to another?
 
Old 03-19-2006, 06:30 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Hi again,

Which shell are you using? Could it be that you are using a (t)csh shell? Using bash/ksh the tar command given works, if I try the same with a (t)csh shell it does not work.

If you are using a (t)csh shell try the following:

( tar -cvf tarfile.tar f1 f2 f3 f4 f5 > stdout_file ) > & stderr_file

Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is output redirection? LinuxPadawan General 5 05-18-2005 12:53 PM
Output redirection rmartine Linux - Newbie 2 01-25-2005 06:31 PM
Minor output redirection problem.. Tyir Linux - General 0 01-27-2004 09:13 PM
output redirection to another directory spyghost Linux - Software 3 09-21-2003 09:28 AM
Output redirection legtester Linux - General 4 07-07-2003 02:36 PM


All times are GMT -5. The time now is 06:19 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration