I actually had the occasion to test these tonight.
tar didn't support the z switch
tar xvzf filename.tar.gz
tar: z: unknown option
Usage: tar {txruc}[vfbFXhiBEelmopwnq[0-7]] [-k size] [tapefile] [blocksize] [exclude-file] [-I include-file] files ...
gunzip without the redirection operator only unzip's the file, pipe to tar didn't seem to work
gunzip filename.tar.gz | tar xvf -
tar: blocksize = 0
Therefore, i stand with my original command line of:
gunzip < filename.tar.gz | tar xvf -
Since it is the only command line that did what I needed.
Quote:
Originally Posted by Perderabo
That z flag on tar is not universal. As for using redirect, that's why I do and I'm not gonna switch. See
this thread for part of the reason. The other part is that keystrokes are a cheap resource even for a slow typist like me. I often use superfluous parentheses in complex expressions. And in a script, I prefer
variable="string"
over
variable=string
In the same way, "gunzip < file | program" seems more clear than "gunzip file | program" especially if the reader never heard of gunzip. Of course, on the other hand, "gunzip < file" isn't going to fly. Here gunzip needs the old filename to construct the new filename. So rather than blindly adopting one technique or the other, be aware of the issues and make your own choice. There's not really a right or wrong here.