I am wondering to ask the difference of these two commands (i.e. only the order of their options are different):
tar -zxvf foo.tar.gz
tar -zfxv foo.tar.gz
The first one ran perfectly but the second one said:
tar: You must specify one of the `-Acdtrux' or `--test-label' options
Try `tar --help' or `tar --usage' for more information.
And tar with --test-label
and -zfxv
said :
tar (child): xv: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Then I looked at tar manual and realised that all the example there are using switch -f
in the end!!
AFAICT there is no need for this restriction, or is there?! because in my view switches should be order free.
gtar option parsing
, you discovered another reason for not using gtar.-f
expects the filename to follow. In your second version, you specified-fxv
, which - for tar - means that the filename is "xv".