Before the command line parameter "-" and "-" the difference

Transfer: https: //www.zhihu.com/question/267095526/answer/319387178

In simple terms, "-" and "-" are two different styles of command-line options. The former is the traditional Unix-style, which is the GNU style.

Specific point of view, the design initially Unix command-line programs, you need a command "Options" (Options) and "parameters" (Arguments) to distinguish, on the introduction of "-."

Where to "-" at the beginning, is the option. Options with a single letter as a symbol, usually an option abbreviated English.

For example, "- a" means all (all), "- c" represents the command (command), '- f' represents a file (file), "- V" indicates the version (version).

Multiple options can write continuously, such as "ls -A -l" can be written as "ls -Al."

However, the number of individual letters is limited, it will be enough, but to express the meaning is not clear enough.

So there after the GNU style to complement the above-mentioned shortcomings, use "-" as a prefix, optionally followed by a string of words, such as "--version", "- all."

Option own parameters which can be placed back separated by a space, you can use the "=", such as "--file foobar.out" is equivalent to "--file = foobar.out."

This option is often called the GNU-style "long options" (Long Options), while Unix-style as "short option" (Short Options).

Generally short option has a corresponding long option, such as "-a, - all" "- V, - version."

Guess you like

Origin www.cnblogs.com/a-s-m/p/11109294.html