Next: Old Options, Previous: Long Options, Up: Styles [Contents][Index]

#### 3.3.2 Short Option Style

Most options also have a short option name. Short options start with a single dash, and are followed by a single character, e.g., `-t` (which is equivalent to `--list`). The forms are absolutely identical in function; they are interchangeable.

The short option names are faster to type than long option names.

Short options which require arguments take their arguments immediately following the option, usually separated by white space. It is also possible to stick the argument right after the short option name, using no intervening space. For example, you might write `-f archive.tar` or `-farchive.tar` instead of using `--file=archive.tar`. Both `--file=archive-name` and `-f archive-name` denote the option which indicates a specific archive, here named `archive.tar`.

Short options which take optional arguments take their arguments immediately following the option letter, without any intervening white space characters.

Short options’ letters may be clumped together, but you are not required to do this (as compared to old options; see below). When short options are clumped as a set, use one (single) dash for them all, e.g., ‘``tar` -cvf`’. Only the last option in such a set is allowed to have an argument3.

When the options are separated, the argument for each option which requires an argument directly follows that option, as is usual for Unix programs. For example:

    $ tar -c -v -b 20 -f /dev/rmt0

If you reorder short options’ locations, be sure to move any arguments that belong to them. If you do not move the arguments properly, you may end up overwriting files.

#### Footnotes

### (3)

Clustering many options, the last of which has an argument, is a rather opaque way to write options. Some wonder if GNU `getopt` should not even be made helpful enough for considering such usages as invalid.

Next: Old Options, Previous: Long Options, Up: Styles [Contents][Index]