Listing 1. Script gsprint

#!/bin/sh
# gsprint -- takes the name of a DVI output file
# as its argumentand postprocesses it using
# ghostscript then spools it to the printer
# using lpr.
dvips -f <$1 >$1.ps
(gs -q -dNOPAUSE -sDEVICE=cdjmono \
   -sOutputFile=- $1.ps quit.ps > \
   /tmp/gs.out ; lpr /tmp/gs.out) &