Whenever I run manual page on a command I get information about arguments, syntax and so on. However, I wounder if that information is valid only for a certain shell and if yes, then for which one?
In other words, would I have different man outputs for csh, ksh, bash and others?
Thanks
Man pages in general are not tied to a particular shell. You should defer to the set of man pages for your particular version of unix. Like aix, solaris, etc.
man pages are independent from the shell so you'll see the same info regardless of the one you use (assuming you have the same version of the manuals, of course). Some distributions pack all the man pages together into a single file (E.g.: man-pages-3.1.0.rpm)
Most times you'd want to see the man page for a particular utility (E.g: curl, ifconfig, lvm) that is not part of the shell.
Some commands are shell built-ins (Eg: cd, alias, source) so if you type man cd you'll be presented with the man page for your shell (built-ins Section).
FWIW - There used to be a book several years ago consisting of man pages *only*. Unfortunately manuals and sections change pretty quickly and I haven't seen that book anymore in the local bookstores.
Thank you for the replies. So since man pages are shell independent, does this mean that the syntax I get from running e.g.
man test
will work in any shell script if I run it on the same server?
Yes, but...
Keep in mind that different operating systems also have different implementations for the same tools, even the simplest ones.
This is particularly noticeable when you compare GNU utilities vs -say- BSD ones.
Almost every Linux system use GNU-based tools but it you were using AIX or Solaris I wouldn't blindly trust that "test" would behave exactly the same.
So, it also depends on who wrote those tools and if they comply with the standards (if any) -- You may be using 'test' written by GNU programmers, while some other server running AIX might be using "test" written by IBM engineers exclusively for AIX.
Thank you so much for the clarification
The test command is somewhat special. Most modern shells also have a test builtin, i.e. [ ], and an extended test builtin, i.e. [[ ]]. You may have to read the shell manpage for your particular shell.
BTW, the bash-3 builtin test or [ ] has a buggy implementation (fixed in bash-4):
test -w and test -r call stat() rather than access(). That goes wrong
- if a file appears writable but the file system is mounted read-only
- a network file system like NFS or AFS, where the Server controls file access independent of the Unix permissions. Examples: NetApp NFS share on an NTFS-style volume; AFS with invisible ACLs.