The 'man' utility that comes with a Debian distro is not as comprehensive as ss64.com, and in environment like cygwin, it is even more so. Is there a software or a script that will make my 'man' more like ss64 pages? ss64.com contains command line reference for many different environments including Windows CMD and Mac OS X, and bash. One example I have is the man page for read
Edit:
From lifehacker.com, I found the following function:
man () { /usr/bin/man $@ || (help $@ 2> /dev/null && help $@ | less) }
help utility gives me the page I am looking for – but it does not bypass the underwhelming man page for read
.
Best Answer
Having a man page for
read
(in section 1 of the manual) that says anything else than "There is noread
command, but your shell might have aread
builtin command, see your shell manual for details" is misleading, becauseread
is a shell builtin and the behaviour and supported options vary from shell to shell.Some systems (generally not Linux ones) however do have a
read
command (in/bin
,/usr/bin
or elsewhere) as POSIX requires (but the Linux Standard Base (LSB) specification lifts that requirement), and on those systems, the man page will describe the behaviour of thatread
command, and will be misleading because it's generally not thatread
that you invoke when you callread
at a shell prompt or in a shell script or insystem()
,popen()
... but the shell builtin one.That http://ss64.com site describes the
bash
builtinread
command (though it doesn't say which version ofbash
, and for instance, it's different from theread
builtin in the version ofbash
on this machine, which itself is different from thatread
from thebash
of another (older) machine I have access to) in abash
section. In that regard, it's not misleading, but where it's very misleading is where it puts all sorts of other non-bash related commands in that same section and sort of implies thatbash
(one of many shells available on Linux and other Unices, shells being one of many ways to run commands) is necessary to run those commands or that those commands have anything to do with it.Now, when you do
man read
, if there's noread
command in section 1 (user commands) of the manual, it will search in other sections. For instance, if you have installed themanpages-dev
package (on Debian), you'll get the man page of theread
system call (in section 2). If not, but you have installed the TCL documentation package, you'll get the man page for theread
TCL function in section3tcl
.You can ask explicitly for the
read
user command withman 1 read
(man -s 1 read
on some systems). If your manual had a1bash
section, it would bring it up before the one in section1zsh
, so you'd need to write itman 1zsh read
to get thezsh
variant. You can get all the man pages withman -a read
, you can find out what packages they come from on Debian with:dpkg -S $(man -wa read)
. For instance, on this system, I have:With
zsh
, pressing Alt-H at the prompt brings the manual (via theman
command) for the command you're currently typing. The defaultzsh
installation on Debian improves it to make use of therun-help
function (seeinfo -f zsh --index-search=run-help
), so you get help for the builtins as well.With the
fish
shell, there's ahelp
builtin function that tries to bring the most sensible documentation for a given command orfish
concept (fromman
or thefish
documentation).If for some reason, you're forced to using
bash
(grin) or can't be bothered to change from the default,bash
also has ahelp
builtin command that brings help onbash
builtins (however note thathelp read
is likehelp '*read*'
, that is it brings the manual for all the builtins whose name containsread
, usehelp '[r]ead'
for instance, if you only want theread
manual).bash
's help only works forbash
builtins. If you want to extend it to include search in the manual in sections 1 (user commands) and 6 (games) and 8 (administrative commands), you could redefine it as: