Notes on Command-Line switches
Many scripts accept command-line options. All options feature a short,
one-letter form, and a long form. Following the GNU conventions, short form
options are preceded by a single hyphen (as in
-b) and long form options
are preceded by two hyphens (as in
Order of Command-Line Arguments
All command-line options have to be passed first, before other types of arguments (file names, package names, etc). In other words,
FooScript -m Foo
FooScript Foo -m # WRONG! Switches must come first.
Switches taking arguments
Some command-line options accept arguments. These arguments must be passed as
the word following the argument, both in short and long forms. For example, say
--long are options that take a parameter. This is the correct
way to use them:
FooScript -s value --long another
These are not recognized:
FooScript -s=value --long another # WRONG! Use distinct tokens.
Do not conglomerate
Each option should be passed in a separate token, even when in short mode. If
-a, -b and -c are options for an imaginary
FooScript -a -b -c blah.txt
is correct, but
FooScript -abc blah.txt # WRONG! Options must be separated.
All scripts have a
--help option (or, in short form,
-h). When a program
that needs arguments is run without arguments, the help text will be displayed.
(Note: Actually, not all scripts conform to this yet, but this is being worked