tar: Mixing

1 
1 3.3.4 Mixing Option Styles
1 --------------------------
1 
1 All three styles may be intermixed in a single 'tar' command, so long as
1 the rules for each style are fully respected(1).  Old style options and
1 either of the modern styles of options may be mixed within a single
1 'tar' command.  However, old style options must be introduced as the
1 first arguments only, following the rule for old options (old options
1 must appear directly after the 'tar' command and some white space).
1 Modern options may be given only after all arguments to the old options
1 have been collected.  If this rule is not respected, a modern option
1 might be falsely interpreted as the value of the argument to one of the
1 old style options.
1 
1    For example, all the following commands are wholly equivalent, and
1 illustrate the many combinations and orderings of option styles.
1 
1      tar --create --file=archive.tar
1      tar --create -f archive.tar
1      tar --create -farchive.tar
1      tar --file=archive.tar --create
1      tar --file=archive.tar -c
1      tar -c --file=archive.tar
1      tar -c -f archive.tar
1      tar -c -farchive.tar
1      tar -cf archive.tar
1      tar -cfarchive.tar
1      tar -f archive.tar --create
1      tar -f archive.tar -c
1      tar -farchive.tar --create
1      tar -farchive.tar -c
1      tar c --file=archive.tar
1      tar c -f archive.tar
1      tar c -farchive.tar
1      tar cf archive.tar
1      tar f archive.tar --create
1      tar f archive.tar -c
1      tar fc archive.tar
1 
1    On the other hand, the following commands are _not_ equivalent to the
1 previous set:
1 
1      tar -f -c archive.tar
1      tar -fc archive.tar
1      tar -fcarchive.tar
1      tar -farchive.tarc
1      tar cfarchive.tar
1 
1 These last examples mean something completely different from what the
1 user intended (judging based on the example in the previous set which
1 uses long options, whose intent is therefore very clear).  The first
1 four specify that the 'tar' archive would be a file named '-c', 'c',
1 'carchive.tar' or 'archive.tarc', respectively.  The first two examples
1 also specify a single non-option, NAME argument having the value
1 'archive.tar'.  The last example contains only old style option letters
1 (repeating option 'c' twice), not all of which are meaningful (eg., '.',
1 'h', or 'i'), with no argument value.
1 
1    ---------- Footnotes ----------
1 
1    (1) Before GNU 'tar' version 1.11.6, a bug prevented intermixing old
1 style options with long options in some cases.
1