OpenSolaris

You are not signed in. Sign in or register.

Heads Up - man does the right thing without MANPATH

Date: Thu, 15 May 2008 07:48:20 -0500
From: "Mike Gerdts" <mgerdts at gmail dot com>
To: on-all at eng dot sun dot com, onnv-gate at onnv dot eng dot sun dot com
Subject: Heads Up - man does the right thing without MANPATH

My putback of

  PSARC/2007/688 manwhich: deriving MANPATH from PATH
  6634079 man should take hints from PATH when MANPATH not set

obviates the need for MANPATH in most cases.  If MANPATH is not set,
man will use PATH to take hints as to where it should search, falling
back to /usr/share/man if necessary.  The following are new ways of
using man that do the right thing.

Example 1:

Display ls(1) from /usr/gnu/share/man, ps(1b) from /usr/share/man, and
nawk(1) from /usr/share/man.

$ export PATH=/usr/gnu/bin:/usr/ucb:/usr/bin
$ unset MANPATH
$ man ls ps
$ man nawk


Example 2:

Display man page for /usr/ucb/ps and /opt/csw/bin/wget

$ export PATH=/usr/bin
# MANPATH is set or unset - doesn't matter
$ man /usr/ucb/ps
$ man /opt/csw/bin/wget


Example 3:

Leverage the new man magic, but be sure that section 2 man pages from
/usr/share/man take precedence.  View man page chmod(2) from
/usr/share/man and see what other chmod man pages exist.

$ export PATH=/usr/gnu/bin:/usr/bin:/usr/sbin
$ unset MANPATH
$ export MANPATH=/usr/share/man,2:`man -p`:/opt/myapp/man
$ man chmod
$ man -l chmod
chmod (2)       -M /usr/share/man
chmod (1)       -M /usr/gnu/share/man
chmod (1)       -M /usr/share/man

-- 
Mike Gerdts
http://mgerdts.blogspot.com/