Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Reading man pages in the current directory' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Reading man pages in the current directory
Authored by: Anonymous on Apr 03, '03 11:58:26AM
Newer GNU-versions of 'man' have a switch for this, but the Jaguar-version doesn't have it

Actually, the switch is -M, which in all standard versions of man (not just GNU man).

If the man page is properly sorted (in a man/man? subdirectory), you can simply do "man -M man PAGE".

Example:
$ ls man
man1 man2 man3 ...
$ ls man/man1
blah.1
$ man -M man blah

If you have installed a standard UNIX software package in a particular root directory (ex: /usr/local/apache), there is probably a local man directory containing all of the correct man pages (/usr/local/apache/man). If the manpages are just left hanging around in the installation root directory, the installer needs to be bonked on the head. Properly using the man command, one could either type "man -M /usr/local/apache/man httpd", or add /usr/local/apache/man to their MANPATH:

Bourne shell and similar others (made permanent by adding to .profile):
$ MANPATH=/usr/local/apache:$MANPATH
$ export MANPATH

C shell and similar others (made permanent by adding to .cshrc):
% setenv MANPATH /usr/local/apache:$MANPATH

Then all you have to do is "man httpd".

If someone is instructed to write a script to perform a task they have to (a) create the script every time they want to perform the task, (b) make a copy of the script in every directory that contains a stray man page, (c) make one copy of the script and call it with its full path every time they want to use it, (d) put the script in a standard UNIX binary location such as /usr/local/bin (which isn't always a good idea), or (e) edit their .cshrc or .profile to include the script's directory in their search path - all of which are silly hacks that make things more difficult than they have to be. For instructions on using the man command the correct way, read its manpage the usual way (below). If you do have a bunch of man pages hanging around in misc areas, you could always sort them into a new man directory (maybe /usr/local/miscman) and add that to your MANPATH.

$ man man

---
--
Gypsy

[ Reply to This | # ]

Reading man pages in the current directory
Authored by: rkt on Apr 04, '03 09:58:22AM

actually, it's recommended that you no longer hand configure your MANPATH, as its now handled automatically by /usr/bin/manpath...

see: man manpath



[ Reply to This | # ]
Reading man pages in the current directory
Authored by: WillyT on Apr 04, '03 11:11:43PM

Sorry but this won't find most of my man pages. If I "unsetenv MANPATH" then run manpath I lose most of finks manpages and all of X11's manpages. I'll continue to keep MANPATH set.

I remember a while back that an OSX update unset my MANPATH and I'm wondering where the heck did all my manpages go.



[ Reply to This | # ]
Reading man pages in the current directory
Authored by: Anonymous on Apr 05, '03 05:31:07PM
The problem with relying on site-wide manpath's is that it is tailored to the system, not the user. A real everyday example would be software I write. I install the software in my home directory ($HOME/bin, $HOME/man, $HOME/etc, ...). I don't want everyone else on the system reading my manpages. In fact, I keep my home directory permissions set at 700. Does my software belong in /usr/local? Not if it's a utility that only I would use (software only a mother could love, trust me!). Not if it's still buggy. Not if I don't want others using it. Solution? A custom MANPATH (the standard UNIX way).

Really, I'm not trying to say the original suggestion of writing a script is wrong. In fact, it's a nice script - short and simple. The point I'm trying to make is that provisions were put in place to deal with non-sitewide man pages 20 years ago in UNIX. The script re-invents the wheel - and the old wheel is still better.

---
--
Gypsy

[ Reply to This | # ]