The discrimination between short and long option is only `-`

command lineoptions

On Unix system, options begin with - is short option, while options begin with -- is long option. Is my understanding right?

Best Answer

That is part of the GNU coding standards, so all GNU (and many non-GNU) software follows it. However, it's by no means an absolute standard; there are other ways of implementing this, such as:

  • -Wlong-option: originated from the C compiler, and specified as such in POSIX.
  • -long-option (i.e., single-dash): supported by most applications (usually as an alternative to the double-dash version) that don't have any short options.
  • +long-option: this is getting out of fashion, but there are a few older software packages that reserved the dash for short options, and the plus sign for long options. Not used much today, mostly because most getopt() implementations don't support it
  • long-option: unfortunately there are also some applications which confuse options with arguments. I believe MegaCLI is one of the offenders there (it is an offender in pretty much everything else, anyway).
Related Question