#!/bin/sh # IsImageOk.sh # 2007-07-16 # Chieh Cheng # http://www.CynosureX.com/ # GNU General Public License (GPL) Version 2, June 1991 scriptName=`echo $0 | sed s/\\\\/.*\\\\///g` if [ $# -ne 1 ] then echo " Usage: $scriptName \"image\"" else file="$1" result=`identify "${file}" 2>&1` if [ "${result}" = "" ] then result=0 else result=`identify "${file}" 2>&1 | egrep -c "[0-9]+x[0-9]+"` corrupt=`identify "${file}" 2>&1 | grep -c "Corrupt"` if [ $corrupt -ne 0 ] then result=0 fi fi echo $result fi