0

Most commands show the help with any of these two options:

vi -h
vi --help

But some others only allow --help

shred --help
xrandr --help

In these second commands, -h shows something like

xrandr: unrecognized option '-h' Try 'xrandr --help' for more information.

What's the point in showing this message instead of showing the help? The -h option is not being used for anything else anyway.

2 Answers 2

5

The command line options/switches that a program accepts are decided by the developer, not the OS.

You can find the repo for the programs which don't accept -h and fork it, change the behavior, and open a PR if you want to :D

2
  • Thanks, I understand that the developer decides. I was looking for the reasoning behind that decision, if any.
    – Katu
    Jul 16, 2017 at 21:22
  • 1
    @Katu in that case this question is off topic on AskUbuntu, but you might be able to ask on one of our sister sites, such as sqa.stackexchange.com Jul 16, 2017 at 21:24
3

One of the contributing factors could be alignment with one standard or another. For example, POSIX requires that "each option name should be a single alphanumeric character".

The -- for multi-letter options is a GNU extension. The requirement of a--helpoption is another GNU requirement.

2
  • I'm still not sure of the details but, after reading this, I think it's a decision to follow POSIX 2008. Showing the help is considered a utility and not an option. Option-arguments should not be optional but the -h doesn't need any... so it makes sense. Thanks for the answer and the link.
    – Katu
    Jul 17, 2017 at 8:47
  • The use of the word utility in that link just refers to the command line program's name. The option part comes from the choice of having the program print its help page vs. actually performing its specific task---you are specifying what the program will do when you run it.
    – Soupy
    Jul 17, 2017 at 9:27

Not the answer you're looking for? Browse other questions tagged .