If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How come "gzip -t" doesn't redirect?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-30-03, 19:27
bgame bgame is offline
Registered User
 
Join Date: Nov 2003
Posts: 23
How come "gzip -t" doesn't redirect?

Hey all,

I'm kind of a newbee to UNIX and need to write a script that checks our "backups", which are just gzip'd tars and sybase dumps. I need to write a script that will use "gzip -t" to test the validity of the compression for a 20-30 files. I cannot for the life of me redirect "gzip -t <filename>.gz" to a file. I want to do this, so I can then search the output for lines that are NOT:

FILENAME.gz: OK

but I can't redirect the output. The only way that I could do it was to use an expect script, which was built through the autoexpect command/script to redirect the output, which I would use to check if the "backups" were OK.

I have 2 1/2 questions:

1) Are there commands that you canNOT redirect?
1 1/2) How would you redirect "gzip -t"

2) If you can't redirect "gzip -t" with a typical shell script, what language would you use?
Reply With Quote
  #2 (permalink)  
Old 12-01-03, 12:14
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,454
Re: How come "gzip -t" doesn't redirect?

Quote:
Originally posted by bgame
Hey all,

I'm kind of a newbee to UNIX and need to write a script that checks our "backups", which are just gzip'd tars and sybase dumps. I need to write a script that will use "gzip -t" to test the validity of the compression for a 20-30 files. I cannot for the life of me redirect "gzip -t <filename>.gz" to a file. I want to do this, so I can then search the output for lines that are NOT:

FILENAME.gz: OK

but I can't redirect the output. The only way that I could do it was to use an expect script, which was built through the autoexpect command/script to redirect the output, which I would use to check if the "backups" were OK.

I have 2 1/2 questions:

1) Are there commands that you canNOT redirect?
1 1/2) How would you redirect "gzip -t"

2) If you can't redirect "gzip -t" with a typical shell script, what language would you use?
I think gzip writes messages to STDERR, not STDOUT. Have you tried

gzip -tv *gz 2>gzip.out
Reply With Quote
  #3 (permalink)  
Old 12-01-03, 15:13
bgame bgame is offline
Registered User
 
Join Date: Nov 2003
Posts: 23
STDERR is the key.

Thanks!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On