-
bash: greater than
Hi,
trying to create a bash script that will shrink jpegs that are larger than 50kb in a directory on my server.
Here's what I've got so far, very early in the process...
the if line errors out with a "command not found". oops.
anyone have any thoughts here for the noob bash scripter?
thanks :)
PHP Code:
for FILENAME in *.jpg #traverse filenames...
do
FILESIZE=$(stat -c%s "$FILENAME")
if ["$FILESIZE" > 50000]
then
echo "$FILENAME is too large = $FILESIZE bytes."
fi
done
exit 0
-
Re: bash: greater than
I think you should change > with -gt.
-
Re: bash: greater than
Code:
if [[ $FILESIZE > 50000 ]] ;then
...
fi
-
Re: bash: greater than
How about this?
Code:
if [ "$FILESIZE" -gt 50000 ]
then
echo "$FILENAME is too large = $FILESIZE bytes."
fi
-
Re: bash: greater than
thanks!
if [[ $FILESIZE > 50000 ]] ;then
did the trick.
syntax!