#!/bin/bash # take two arguments (first a jpeg) and make a thumbnail size version # stored in the second argument if [ $# != 2 ] then echo "$0: need 2 arguments: source-jpeg destination-file" exit 1 fi (djpeg < $1) | pnmscale -xysize 100 150 | cjpeg > $2 # exit code is taken from last command(s) executed if not given explicitly