Listing 4. Script pvga

#!/bin/sh
# pvga -- calls dvips and then ghostscript to
# preview a dvi output file.
# Uses tty1 - tty9 non-X vga virtual terminals.
if [ $# -eq 1 ]; then
   dvips -f <$1 >$1.ps
   gs -sDEVICE=linux -r4 -g640x960 $1.ps
   exit 0
elif [ $# -eq 2 ]; then
   dvips -pp$2 -f <$1 >$1.ps
   gs -sDEVICE=linux -r4 -g640x960 $1.ps
   exit 0
elif [ $# -eq 3 ]; then
   dvips -pp$2 -f <$1 >$1.ps
   gs -sDEVICE=linux -r4 -g640x960 -dYO=$3 $1.ps
   exit 0
fi
echo Usage: pvga file [pagelist] [y-offset]
exit 1