man page in Xdialog
#! /bin/bash
# prrpose:man page shown in Xdialog , testing on FC3 ,twf_cc@sohu.com
# Xdialog , bash 2.0X or above required
# name: xmanual.sh
pn=${0##*/}
temp="$HOME/manual.$$"
trap "rm -f $temp" 0 1 2 9
prog=Xdialog
str="輸入檢視的指令"
if (( $# == 0 )) ; then
$prog --title "$pn" --backtitle "$str" --inputbox "" 0 0 2> $temp
else
arg=$1 ;
echo "$arg" > $temp
fi
retval=$?
case "$retval" in
0)
i=$(<$temp) ;
[ -n "$i" ] || {
echo "Null string, $pn exit" ; exit 1 ;
}
if man $i > /dev/null 2>&1 ; then
man $i | col -b > $temp ;
else
echo "$i: no such manual page." >&2
exit 1 ;
fi
;;
1 | 255)
echo "Abort." ;
exit 1 ;
;;
esac
#printer button not tested cause no printer
$prog --title "$pn" --no-cancel --print "lpr -P lp0" --textbox "$temp" 20 90
rm -f $temp