(tar)Mixing Styles
Prev:
Old Options Up:
Option Styles
Mixing Option Styles
--------------------
All three styles may be intermixed in a single `tar' command, as
long as the rules for each style are fully respected.
In GNU `tar' up to 1.11.6, using old style options was cutting out
the possibility of using many options not having short forms. Many
users rightly expressed their frustration at fighting with the current
`tar' option decoder, so I changed it. However, GNU `tar' needs to be
compatible with other `tar's, in the things that other `tar's can do.
Short options should provide upward compatibility. So, if the current
option decoding raises incompatibilities, please let me know.
Old style options and modern options may be mixed on a single call
to the `tar' program. However, old style options should be introduced
in the first argument only; modern options may be given only after all
arguments to old style options have been collected. If this rule is
not respected, a modern option might be falsely interpreted as the
value of the argument to one of the old style options.
For example, currently, all the following commands are wholly
equivalent, and illustrate many combinations and orderings of option
styles.
tar --create --file=archive.tar
tar --create -f archive.tar
tar --create -farchive.tar
tar --file=archive.tar --create
tar --file=archive.tar -c
tar -c --file=archive.tar
tar -c -f archive.tar
tar -c -farchive.tar
tar -cf archive.tar
tar -cfarchive.tar
tar -f archive.tar --create
tar -f archive.tar -c
tar -farchive.tar --create
tar -farchive.tar -c
tar c --file=archive.tar
tar c -f archive.tar
tar c -farchive.tar
tar cf archive.tar
tar f archive.tar --create
tar f archive.tar -c
tar fc archive.tar
On the other hand, the following commands are *not* equivalent to
the previous set:
tar -f -c archive.tar
tar -fc archive.tar
tar -fcarchive.tar
tar -farchive.tarc
tar cfarchive.tar
These last examples mean something completely different of what the user
might have intended. The first four specify that the `tar' archive
would be a file named `-c', `c', `carchive.tar' or `archive.tarc',
respectively. The first two examples also specify a single non-option,
NAME argument having value `archive.tar'. The last example contains
only old style option letters (repeating option `c' twice) and no
argument value.
automatically generated by info2www version 1.2