Hi all. I also had problems with this, so I got out my trusty hatchet, and
paid a visit to /usr/bin/apropos. The result is given below. Basically, I
just kept hacking at it until it performed as expected on my system. Your
results may be different. Look at the 'manpath' assignment near the start,
and change it to suit your system.
If anyone has a better fix please post it!
----------------------- CUT HERE ---------------------
#! /bin/sh
#
# apropos -- search the whatis database for keywords.
#
# Copyright (c) 1990, 1991, John W. Eaton.
#
# You may distribute under the terms of the GNU General Public
# License as specified in the README file that comes with the man
# distribution.
#
# John W. Eaton
# Department of Chemical Engineering
# The University of Texas at Austin
# Austin, Texas 78712
#
# apropos-1.4 aeb 941007
#
# *** NOTE: this file has been tampered with
#
# how to avoid hardcoding the following?? manpath=$MANPATH does not work because
# MANPATH is colon-delimited. Is there a facility in bash to do this kind of
# string manipulation?? would be nice to avoid running a program just to do this
# simple task.
manpath="/usr/local/man /usr/man /usr/man/preformat /usr/X11/man /usr/openwin/man"
PAGER=/usr/bin/less
if [ $# = 0 ]
then
echo "usage: `basename $0` keyword ..."
exit 1
fi
if [ "$manpath" = "" ]
then
echo "apropos: manpath is null"
exit 1
fi
if [ "$PAGER" = "" ]
then
PAGER="%pager%"
fi
# avoid using a pager if only output is "nothing appropriate"
nothing=
found=0
while [ $found = 0 -a -n "$1" ]
do
for d in $manpath /usr/lib
do
if [ -f $d/whatis ]
then
if grep -is "$1" $d/whatis > /dev/null
then
found=1
fi
fi
done
if [ $found = 0 ]
then
nothing="$nothing $1"
shift
fi
done
if [ $found = 0 ]
then
for i in $nothing
do
echo "$i: nothing appropriate"
done
exit
fi
while [ $1 ]
do
for i in $nothing
do
echo "$i: nothing appropriate"
done
nothing=
found=0
for d in $manpath /usr/lib
do
if [ -f $d/whatis ]
then
if grep -i "$1" $d/whatis
then
found=1
fi
fi
done
if [ $found = 0 ]
then
echo "$1: nothing appropriate"
fi
shift
done | $PAGER
exit
----------------------- CUT HERE ---------------------
Good luck!