Computing.Net > Forums > Unix > Not seeing what is done (?)

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Not seeing what is done (?)

Reply to Message Icon

Name: LANkrypt0
Date: July 30, 2003 at 11:48:25 Pacific
OS: FreeBSD
CPU/Ram: n/a
Comment:

I use pine for mail, but my folders started getting huge, so I made a simple little script to tar/gzip all the files when I exit pine and then untar/gunzip when I am going in to access everything. My only problem is that I am seeing what is going on and I would like that stuff hidden so its not visible.

Any suggestions?



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: July 30, 2003 at 13:35:16 Pacific
Reply:

Do you mean that you are seeing the output from the tar command, ie the list of all of the files being tarred/untarred??


If so, just redirect the output to /dev/null

tar zcvf blah * >/dev/null 2>&1

This redirects both stdout and stderr to the bit bucket (nowheresville)


Or if you'd like to have the output saved somewhere:

tar zcvf blah * >>/mydir/myfile.log 2>&1


0

Response Number 2
Name: LANkrypt0
Date: July 30, 2003 at 13:39:48 Pacific
Reply:

Thats exactly it, the output from tar and rm and gzip. Perhaps Ill keep a logfile of this stuff so I can view it for errors.

Same thing for each command?
actual code:

gunzip $mroot/mailtar/test.tar.gz
tar -xvf $mroot/mailtar/test.tar
rm -rf $mroot/mailtar

pine -z

mkdir $mroot/mailtar
tar cvf $mroot/mailtar/test.tar $(ls /y1/u1/home/jasonp/mail/*)
gzip $mroot/mailtar/test.tar

So I would basically do a >> /path/file.log 2>&1 for each of those lines?


0

Response Number 3
Name: Don Arnett
Date: July 30, 2003 at 13:55:24 Pacific
Reply:

>> means append

> means start a new output file

2>&1 means send stderr to same place as stdout


I'd suggest outputting the date and then appending each commands output to the same file:

date >/path/file.log 2>&1
gunzip $mroot/mailtar/test.tar.gz >>/path/file.log 2>&1
tar -xvf $mroot/mailtar/test.tar >>/path/file.log 2>&1
rm -rf $mroot/mailtar >>/path/file.log 2>&1


Note the single > after the date command, this will cause the file to be overwritten each time. If you don't want that you could change that to a double >> also.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Not seeing what is done (?)

What is wrong? www.computing.net/answers/unix/what-is-wrong/7478.html

What is Unix? www.computing.net/answers/unix/what-is-unix/4428.html

works in shell, not in script www.computing.net/answers/unix/works-in-shell-not-in-script/6535.html