#!/bin/sh # utility script for printing in a CIP pool # $Id: print.sh,v 1.3 2023/09/27 11:55:43 oj14ozun Exp $ # https://wwwcip.cs.fau.de/~oj14ozun/src+etc/print.sh # To the extent possible under law, the person who associated CC0 with # this script has waived all copyright and related or neighboring rights. help() { cat </dev/stderr exit 1 } LOCATION=$(hostname) while : do case $1 in help|--help) help;; d|duplex) DUPLEX=t;; t|tumble) TUMBLE=t;; bw|gray) GRAYSCALE=t;; v|verbose) VERBOSE=t;; dryrun|dry-run) DRYRUN=t;; CIP1|cip1) LOCATION="cip1";; CIP2|cip2) LOCATION="cip2";; bib|bibcip) LOCATION="cip8";; --|*) break ;; esac shift done # see https://wwwcip.cs.fau.de/cipPools/equipment.en.html case $LOCATION in cip1*) PRINTER="ps1acip" if [ -n "$TUMBLE" ] then PRINTER="$PRINTER"t elif [ -n "$DUPLEX" ] then PRINTER="$PRINTER"d fi ;; cip2*) PRINTER="ps2acip" if [ -n "$TUMBLE" ] then PRINTER="$PRINTER"t elif [ -n "$DUPLEX" ] then PRINTER="$PRINTER"d fi ;; cip8*) PRINTER="ps2ccip" if [ -n "$GRAYSCALE" ] then PRINTER="$PRINTER"bw fi if [ -n "$TUMBLE" ] then PRINTER="$PRINTER"t elif [ -n "$DUPLEX" ] then PRINTER="$PRINTER"d fi ;; *) die "No known printer nearby, specify one manually" ;; esac if [ -n "$VERBOSE" ] then echo lpr -P"$PRINTER" "$@" fi if [ -z "$DRYRUN" ] then lpr -P"$PRINTER" "$@" fi