Your groff command references $o but your script sets no value for it, so $o is either empty or inherited from your environment.
* Alain D D Williams <a...@phcomp.co.uk> [21-02/22=Mo 12:58 +0000]: > On Mon, Feb 22, 2021 at 06:04:15AM -0600, Richard Owlett wrote: >> I have downloaded a program with a man-page in troff format. >> How do I view it? >> I installed troffcvt but its man-page is non-informative. >> TIA > > Feel free to use my script to do that, below. > > ps_print is another script that send to my printer. > > **************** > #!/bin/ksh > # Format up a man page, the file name is the argument > # ADDW, July 1999 > > progname=$0 > > Usage() { > cat <<-! > Process a file with the man macros. > Usage: $0 [opts] [file] > -p generate (Postscript) output to current printer > -x eXplain > ! > exit $1 > } > > Postscript=0 > > while getopts px arg > do case "$arg" in > p) Postscript=1;; > x) Usage 0;; > esac > done > > shift $((OPTIND - 1)) > > > if [ $# -eq 0 ] > then echo "Usage: $0 filename" >&2 > exit 2 > fi > > if [ $Postscript = 1 ] > then groff -man -etpsR -rO0.75i -rW6.5i -rL11i $o $1 | ps_print > else tbl $1 | nroff -man | col | less > fi > ****************