#
# if MAXFILES is not set, set to 10
#
if [ -z "MAXFILES" ]
then
MAXFILES=10
fi
#
# now check to see if the number of files being removed is > MAXFILES
# but only if MAXFILES = 0
#
if [ $# -gt "$MAXFILES" -a "$MAXFILES" -ne 0 ]
then
# if it is, prompt user before removing files
echo "Remove $# files (y/n)? \c"
read reply
if [ "$reply" = y ]
then
rm "$@"
else
echo "files not removed"
fi
else
# number of args <= MAXFILES
rm "$@"
fi
The above program I have to remove files. However when I attempt to run it, its telling me that
line 15: [: : integer expression expected
if [ -z "MAXFILES" ]
.if [ $# -gt "${MAXFILES:=10}" -a "$MAXFILES" -ne 0 ]
is enough without above lines