Equals vs space (“-o=value” vs “-o value”) in *nix

2019-02-26 05:32发布

问题:

I see no pattern in command line programs that take

-o=value

versus

-o value

For double dash long options, I see a major preference to the equals notation but not for short options. Is there a reason or best practice?

回答1:

After some Googling it seems most discussions of the evolution of command-line arguments couple the rise of the = sign to the rise of GNU-style long options. I can't find a reference stating explicitly that it was never common practice to use = to separate short options from their arguments, but I also can't find any discussion of anyone doing that.

Some brief discussions ...

  • Art of Command Line Programming - Command Line Options - see introduction
  • perl Getopt::Long - see "Command Line Options, an Introduction" section
  • Command-line interface - no discussion of history, but perhaps further clicking might unearth some