sh script question
Rhonda Gaines
rrg at fibercom.COM
Thu Apr 11 23:38:11 AEST 1991
I am trying to edit the following script to check if a man page has been
compressed and if so to pipe it through zcat first and then eroff it.
The problem is that sh is not recognizing the *.Z as a wildcard. Any ideas?
I'm pretty new at this so any help will be appreciated.
-rhonda
#! /bin/sh
#
# Usage: lpman <command> [section]
#
# Print hardcopy of online manual pages for <command> in [section].
# If section is not given, print all instances of <command> found.
# If <command> is a string enclosed with double-quotes, any wildcard
# characters will be expanded as the search for man pages is made
# (e.g. 'lpman "init*"' will print all instances of man pages starting
# with the string "init").
#
# $1 = manual entry
# $2 = section number
FILES=`find /usr/man/man*$2* -name "$1.*" -print`
if test "$FILES" = "" ; then
echo -n "No manual entry for $1"
if test "$2" = "" ; then
:
else
echo -n " in section ($2)"
fi
echo
else
if test "$FILES" = "*.Z" ; then
echo -n "$1 is compressed, piping output through zcat"
/usr/ucb/zcat $FILES|/usr/local/bin/eroff -man $FILES
else
/usr/local/bin/eroff -man $FILES
echo -n "Manual page for $1"
fi
if test "$2" = "" ; then
:
else
echo -n " ($2)"
fi
echo " sent to LaserWriter"
fi
More information about the Comp.unix.questions
mailing list