When I want to redirect any verbose output I usually do the following,
[arif@arif test]$ rsync -v /home/arif/storage . 1> stdout
[arif@arif test]$ cat stdout
storage
sent 177 bytes received 35 bytes 424.00 bytes/sec
total size is 88 speedup is 0.42
But when I do the same thing with gzip it creates different result,
[arif@arif test]$ gzip -v something 1> stdout 2> stderr
[arif@arif test]$ cat stdout
[arif@arif test]$ cat stderr
something: 0.0% -- replaced with something.gz
Why verbose output of gzip goes to stderr instead of stdout? This is very problematic for scripting as at the end of the script, an error file is checked and if anything found on the file, a cleanup process is done.
Question is ,
- Why verbose output of
gzipgoes tostderrinstead ofstdout? - How can I overcome this?