Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    23

    Unanswered: 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?

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: How come "gzip -t" doesn't redirect?

    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
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Nov 2003
    Posts
    23
    STDERR is the key.

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •