#!/bin/sh usage() { echo "usage: ps2pbm [-r resolution] [psfile]" >&2 exit 1 } while getopts ":r:" c do case "$c" in r) res="-r$OPTARG";; :|'?') usage;; esac done shift $(($OPTIND - 1)) psfile=-_; if [ $# -gt 0 ]; then psfile=$1; fi gs -dBATCH -dNOPAUSE -sDEVICE=pbmraw $res -sOutputFile=- -q "$psfile" .