Listing 2. Script gspreview

#!/bin/sh
# gspreview -- takes the complete name of a DVI
# output file as its argument and uses ghostscript
# to preview the file in a X window.
dvips -f <$1 >$1.ps
gs -r72 -sDEVICE=X11 $1.ps