All,
For what it is worth, I like to have an automatic list of manual pages
presented when there is more than one matching page available (similar to
whatis) I also like to be able to select which page to display from the that
list, without having to type 'man pg name' again. This has always been a feature
on some oh the other distros. I couldn't find anything that would do that on
Arch, so I wrote a small function that can be aliased to provide the functionality.
If you're interested, it is:
## function to alias as man on arch to provide
# user selection of available man pages
manselect() {
[ -z "$1" ] && return 1
if [ -z "$2" ]; then
local timeout=5
local pgs=( $(whatis "$1" | sed -e 's/^.*[(]//' -e 's/[)].*$//') )
local npgs=${#pgs[@]}
[ $npgs -eq 0 ] && return 1
local pg=${pgs[0]}
if [ $npgs -eq 1 ]; then
/usr/bin/man $pg "$1"
else
local line
while read -r line; do
printf " %s\n" "${line%)*})"
done < <(whatis "$1")
printf "Select a man page (%s): " "$pg"
read -t $timeout ans && pg=$ans || echo ""
/usr/bin/man $pg "$1"
fi
else
if [ ${1:0:1} -eq ${1:0:1} ] >/dev/null 2>&1 ; then
/usr/bin/man $1 "$2"
else
printf "error: invalid man page specification: '%s'\n" "man $1 $2"
fi
fi
}
I just include it as a function in .bashrc and then provide an alias:
alias man='manselect'
You can adjust the order the man pages are presented in by adjusting the
SECTION order in /etc/man_db.conf. This can tailor the order of which page is
shown by default if no selection is made.
Thought I would pass it along...
--
David C. Rankin, J.D.,P.E.