I use "--help"
or "-h"
a lot. By default it uses cat
to open help file. How can i set it to use less
by default. I want the result of "command --help |less"
to be the same as "command --help"
An alias for --help
wouldn't work. Aliases only apply to command names, not to their arguments. I wouldn't recommend a completely invisible solution, anyways. Too much command-line magic can create bad habits.
You could create a help command instead.
h() { "$@" --help | less; }
$ h cat
Usage: cat [OPTION]... [FILE]...
<snip>