8.1.2 Command description format for UNIX-compatible commands
The following specification rules apply to UNIX-compatible commands except for those in the script format:
Options are classified as either short options or long options.
Two consecutive hyphens (--) indicates the end of the specification of options. All character strings (including options) that follow double hyphens are processed as operands.
The following subsections explain the description formats for short options and long options.
- Organization of this subsection
(1) Specification format for short options
A short option consists of one hyphen (-) followed by one predefined character.
The specification format for short options is shown below. Whether the option value can be omitted depends on the option.
-short-option-name[0option-value]
The rules for specifying short options are as follows:
Option names specified without a value can be grouped together as a block (for example, -a -b -c can be specified as -abc). In this case, a value can be specified for the last option (for example, in the specification -abc xyz, xyz is the value of option -c).
Some options do not allow a space before the option value. If a space is specified before the option value for such an option, the option value will be treated as an operand.
In the Syntax section in the descriptions of the individual commands in this chapter, an option that is shown without any space before its option value is an option in which a space cannot be specified.
(2) Specification format for long options
A long option consists of two consecutive hyphens (--) followed by a predefined character string.
The specification format for long options is shown below. Whether the option value can be omitted depends on the option.
--long-option-name[=option-value]
An option with an option value can also be specified in the format shown below. Note that in the case of an option whose option value can be omitted, the long option name must be separated from the option value by the equal sign (=). If a space is specified instead of an equal sign, the option value will be treated as an operand.
--long-option-name
1option-value
Long option names and their option values cannot be abbreviated. For example, an error results if you specify --char list for the --characters option of the cut command or --format=l for the --format option of the ls command.
- Important
For the options that have both short and long option formats, only the short option is explained in this manual (although both are shown in the Arguments section of the command descriptions). For the options that do not have a short options, the long option is explained. In the Syntax section in the command descriptions, the long option names are provided after the short option names for the long options that have no relationship with other options.
For example, the --side-by-side long option of the -y option of the diff command is not provided in the Syntax section of the command description. On the other hand, the --suppress-common-lines long option is provided in the Syntax section because it does not have a corresponding short option.
(3) Notes about commands
-
For cp, cut, date, diff, gunzip, gzip, ln, ls, expand, mv, and stat commands, the specification order of options and operands is arbitrary. If an option is specified after an operand, the option is processed as the option.
If you specify one of the environment variables listed below, you must specify operands after all the options have been specified on the command line. Options specified after the operands will be treated as operands. For details about these environment variables, see 2.5 Specifying environment variables.
POSIXLY_CORRECT environment variable
ADSH_CMD_ARGORDER=seq environment variable
-
If you specify options and operands in the awk, find, getopt, tr, or xargs command, first specify all options and then specify operands.
If you specify options and operands in the following commands, you can specify options and operands in any order in Linux, but you must specify options first and then specify operands in AIX, HP-UX, Solaris, and Windows:
cat, cmp, egrep, grep, head, mkdir, paste, rm, sed, sort, split, tail, touch, uniq, wc, which
If you specify the POSIXLY_CORRECT environment variable in Linux, the same operation as the AIX, HP-UX, Solaris, or Windows operation can be performed.
For the POSIXLY_CORRECT environment variable, see 2.5 Specifying environment variables.