Code: Select all
#! /bin/sh
ifile=input.jpg
identify $ifile &> /dev/null && {
echo "DEBUG: moving the jpg"
mv -v $ifile foo.jpg
} || {
rm $ifile
echo "Input file not a valid image"
}
Code: Select all
$ ls
im-test.sh
$ ./im-test.sh
DEBUG: moving the jpg
mv: cannot stat ‘input.jpg’: No such file or directory
rm: cannot remove ‘input.jpg’: No such file or directory
Input file not a valid image
$ identify.im6: unable to open image `input.jpg': No such file or directory @ error/blob.c/OpenBlob/2638.
^C
$
$ touch input.jpg
$ ./im-test.sh
DEBUG: moving the jpg
‘input.jpg’ -> ‘foo.jpg’
$ identify.im6: unable to open image `input.jpg': No such file or directory @ error/blob.c/OpenBlob/2638.
^C
$
$ identify -version
Version: ImageMagick 6.7.7-10 2013-09-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
This is mucking up the behaviour of my script. Please help!