tar: Old Options
1
1 3.3.3 Old Option Style
1 ----------------------
1
1 As far as we know, all 'tar' programs, GNU and non-GNU, support "old
1 options": that is, if the first argument does not start with '-', it is
1 assumed to specify option letters. GNU 'tar' supports old options not
1 only for historical reasons, but also because many people are used to
1 them. If the first argument does not start with a dash, you are
1 announcing the old option style instead of the short option style; old
1 options are decoded differently.
1
1 Like short options, old options are single letters. However, old
1 options must be written together as a single clumped set, without spaces
1 separating them or dashes preceding them. This set of letters must be
1 the first to appear on the command line, after the 'tar' program name
1 and some white space; old options cannot appear anywhere else. The
1 letter of an old option is exactly the same letter as the corresponding
1 short option. For example, the old option 't' is the same as the short
1 option '-t', and consequently, the same as the long option '--list'. So
1 for example, the command 'tar cv' specifies the option '-v' in addition
1 to the operation '-c'.
1
1 When options that need arguments are given together with the command,
1 all the associated arguments follow, in the same order as the options.
1 Thus, the example given previously could also be written in the old
1 style as follows:
1
1 $ tar cvbf 20 /dev/rmt0
1
1 Here, '20' is the argument of '-b' and '/dev/rmt0' is the argument of
1 '-f'.
1
1 The old style syntax can make it difficult to match option letters
1 with their corresponding arguments, and is often confusing. In the
1 command 'tar cvbf 20 /dev/rmt0', for example, '20' is the argument for
1 '-b', '/dev/rmt0' is the argument for '-f', and '-v' does not have a
1 corresponding argument. Even using short options like in
1 'tar -c -v -b 20 -f /dev/rmt0' is clearer, putting all arguments next to
1 the option they pertain to.
1
1 If you want to reorder the letters in the old option argument, be
1 sure to reorder any corresponding argument appropriately.
1
1 This old way of writing 'tar' options can surprise even experienced
1 users. For example, the two commands:
1
1 tar cfz archive.tar.gz file
1 tar -cfz archive.tar.gz file
1
1 are quite different. The first example uses 'archive.tar.gz' as the
1 value for option 'f' and recognizes the option 'z'. The second example,
1 however, uses 'z' as the value for option 'f' -- probably not what was
1 intended.
1
1 This second example could be corrected in many ways, among which the
1 following are equivalent:
1
1 tar -czf archive.tar.gz file
1 tar -cf archive.tar.gz -z file
1 tar cf archive.tar.gz -z file
1