gzip: stdin: not in gzip format

Ever accidentally ran gunzip on non gzipped content? I’m sure you have. Here’s what would happen:

$ echo foo | gunzip

gzip: stdin: not in gzip format

To run gunzip only if necessary on stdin, you can do the following:

$ echo foo | zless | cat

foo

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>