#!/bin/sh progname=`basename $0` dvired=false case $1 in -r) DVIPS=dvired shift ;; *) DVIPS=dvips ;; esac case $# in 0) echo "Usage: $progname [-r] files ..." >&2 exit ;; esac findopt= dvipsopt= for i do if [ -f $i ] || [ -d $i ]; then findopt="$findopt $i" else dvipsopt="$dvipsopt $i" fi done find $findopt -name \*.dvi -type f -print | while true; do read i test -z "$i" && exit echo "processing file '$i' ..." $DVIPS $dvipsopt -f "$i" >/dev/null echo done