tools/batch_* scripts: verify number of arguments before invoking 'shift'.

This commit is contained in:
Sebastian Gassner 2012-11-13 15:11:34 +01:00
parent f561785274
commit 274da3dcb6
3 changed files with 15 additions and 12 deletions

View File

@ -12,14 +12,9 @@
VIPSHOME=${VIPSHOME-@prefix@}
name=`basename $0`
left=$1
top=$2
width=$3
height=$4
shift 4
# check args
if [ $# -lt 1 ]; then
if [ $# -lt 5 ]; then
echo "usage: $name left top width height image1 image2 ..."
echo
echo "$name writes a new set of images called crop_image1, "
@ -28,6 +23,12 @@ if [ $# -lt 1 ]; then
exit 1
fi
left=$1
top=$2
width=$3
height=$4
shift 4
# convert each argument
for i in $*; do
dir=`dirname $i`

View File

@ -12,11 +12,9 @@
VIPSHOME=${VIPSHOME-@prefix@}
name=`basename $0`
type=$1
shift
# check args
if [ $# -lt 1 ]; then
if [ $# -lt 2 ]; then
echo "usage: $name <new image type> image1 image2 ..."
echo
echo "$name uses VIPS to convert a group of image files of"
@ -27,6 +25,9 @@ if [ $# -lt 1 ]; then
exit 1
fi
type=$1
shift
# convert each argument
for i in $*; do
# drop the suffix on the filename

View File

@ -14,11 +14,9 @@ VIPSHOME=${VIPSHOME-@prefix@}
# get name we were run as
name=`basename $0`
rec=$1
shift
# check args
if [ $# -lt 1 ]; then
if [ $# -lt 2 ]; then
echo "usage: $name matrix image1 image2 ..."
echo "writes rsc_image1, rsc_image2, ..."
echo
@ -28,6 +26,9 @@ if [ $# -lt 1 ]; then
exit 1
fi
rec=$1
shift
# transform each argument
for i in $*; do
echo "Transforming $i to rsc_$i ..."