#!/bin/bash # # this script reads a postscript file from stdin and # converts it to pdf using ghostscript. it takes 2 args: # arg1 = printer name # arg2 = number of copies to print # if test $# -lt 2 then echo "Not enough arguments."; exit 1 fi if test $# -gt 2 then echo "Too many arguments."; exit 1 fi if [ $1 == lpx ]; then gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- /dev/stdin | lpr -P$1 -\# $2 else cat /dev/stdin | lpr -P$1 -\# $2 fi