Do command line options take an equals sign between option name and value?
In general, the implementation of how command-line arguments are interpreted is left completely at the discretion of the programmer.
That said, in many cases, the value of a "long" option (such as is introduced with --option_name
) is specified with an =
between the option name and the value (i.e. --option_name=value
), whereas for single-letter options it is more customary to separate the flag and value with a space, such as -o value
, or use no separation at all (as in -oValue
).
An example from the man-page of the GNU date utility:
-d, --date=STRING display time described by STRING, not 'now' -f, --file=DATEFILE like --date; once for each line of DATEFILE
As you can see, the value would be separated by a space from the option switch when using the "short" form (i.e. -d
), but by an =
when using the "long" form (i.e. --date
).
Edit
As pointed out by Stephen Kitt, the GNU coding standard recommends the use of getopt
and getopt_long
to parse command-line options. The man-page of getopt_long
states:
A long option may take a parameter, of the form
--arg=param
or--arg param
.
So, a program using that function will accept both forms.