#!/bin/bash if [[ $1 == -h ]]; then echo "usage: scan [ [ []]]" exit fi resolution=${1:-200} format=${2:-jpg} extra=$3 if [[ -n $extra ]]; then extra="_$extra" fi file="scan_$(date +%Y-%m-%d_%H%M%S)${extra}.${format}" scanimage -x 214.98 -y 294.973 --resolution $resolution | convert - "$file"