It is a good idea to follow the POSIX guidelines for the
command-line options of a program. The easiest way to do this is to use
getopt to parse them. Note that the GNU version of
will normally permit options anywhere among the arguments unless the
special argument ‘--’ is used. This is not what POSIX
specifies; it is a GNU extension.
Please define long-named options that are equivalent to the
single-letter Unix-style options. We hope to make GNU more user
friendly this way. This is easy to do with the GNU function
One of the advantages of long-named options is that they can be consistent from program to program. For example, users should be able to expect the “verbose” option of any GNU program which has one, to be spelled precisely ‘--verbose’. To achieve this uniformity, look at the table of common long-option names when you choose the option names for your program (see Option Table).
It is usually a good idea for file names given as ordinary arguments to be input files only; any output files would be specified using options (preferably ‘-o’ or ‘--output’). Even if you allow an output file name as an ordinary argument for compatibility, try to provide an option as another way to specify it. This will lead to more consistency among GNU utilities, and fewer idiosyncrasies for users to remember.
All programs should support two standard options: ‘--version’
and ‘--help’. CGI programs should accept these as command-line
options, and also if given as the
PATH_INFO; for instance,
http://example.org/p.cgi/--help’ in a browser should
output the same information as invoking ‘p.cgi --help’ from the
|• --version:||The standard output for –version.|
|• --help:||The standard output for –help.|