|
[Lug-bg] нахранете ме отзад (feedback) моля
- Subject: [Lug-bg] нахранете ме отзад (feedback) моля
- From: Delian Krustev <krustev@xxxxxxxxxxx>
- Date: Tue, 16 Feb 2010 03:10:28 +0200
#!/bin/sh
# usage: $0 PAGE
#
# Searches for manual pages for PAGE and prompts which one to display if more
# than one is found.
#
# Could be installed as /usr/local/bin/man which will usually be found in PATH
# before the default "man" command. Another suggestion - /usr/local/bin/m .
#
# Author: Delian Krustev <krustev@xxxxxxxxxxx>
#
# Licence: This script is in the public domain.
#
# FEEDBACK:
# - Does it interfere with something on your system when
# installed in place (or before) the default man binary ?
# - Any posix shell incompatibilities, nonstandard commands or command
# options ?
# - Optimizations, bugs, similar utilities ?
MAN=/usr/bin/man
if [ $# != 1 ]; then
exec $MAN "$@"
fi
if ! tty > /dev/null ; then
exec $MAN "$@"
fi
PAGES="`whereis -m $1 | cut -d : -f 2-`"
echo $PAGES | grep ' ' > /dev/null || exec $MAN "$@"
echo "This page is available in several sections:
"
# There should be a better way to sort pages.
# The "rev" stuff is ugly and errorprone - sed ?
for i in `for j in $PAGES ; do echo $j ; done | sort `; do
printf "%10s %s\n" \
"[`echo $i | cut -d . --output-delimiter ' ' -f 1- | rev | cut -d ' ' -f 2 | rev`]" \
$i
done
echo "
Type a section or hit Enter for the default:"
# $MAN is smart enough to display the proper section if it has enough chars
# to make a difference. E.g. you could type "3p" for "3posix".
read section
exec $MAN $section $1
_______________________________________________
Lug-bg mailing list
Lug-bg@xxxxxxxxxxxxxxxxxx
http://linux-bulgaria.org/mailman/listinfo/lug-bg
|
|
|