diff frontends/wix/images/split_card.sh @ 100:50f1591c8fc6

split_card script: added syntaxe checking
author Goffi <goffi@goffi.org>
date Fri, 18 Jun 2010 17:14:14 +0800
parents 7471ffcda33b
children 23023aff91fd
line wrap: on
line diff
--- a/frontends/wix/images/split_card.sh	Fri Jun 18 15:19:32 2010 +0800
+++ b/frontends/wix/images/split_card.sh	Fri Jun 18 17:14:14 2010 +0800
@@ -49,6 +49,22 @@
 	exit 1
 fi
 
+SYNTAXE="Split card image\nsyntaxe: $0 jpeg_image_to_split.jpg"
+
+if [ $# -ne 1 ]
+then
+	echo  $SYNTAXE
+	exit 1
+fi
+
+echo `file -b --mime-type $1` | grep image 2>&1 > /dev/null
+
+if [ $? -ne 0 ]
+then
+	echo "target file is not an image"
+	exit 1
+fi
+
 current=`pwd`
 #TODO: check directory presence
 #echo "making directory"