1 #!/bin/sh 2 3 case "$#" in 4 1) MPRFILTER=cat;; 5 2) if test ! -r "$2"; then 6 echo "$1: error: cannot read $2" >&2 7 exit 1 8 fi 9 if file "$2" | grep compress >/dev/null 2>&1; then 10 MPRFILTER="gzip -dc $2" 11 else 12 MPRFILTER="cat $2" 13 fi;; 14 *) echo "usage: mprfilter prog [filename]" >&2 15 exit 1;; 16 esac 17 18 echo "$MPRFILTER" 19 exit 0