I am currently trying to write a bash script which helps me step through a directory and check for .jpeg or .jpg extensions on files. I've come up with the following:
#declare $PICPATH, etc...
for file in $PICPATH
if [ ${file -5} == ".jpeg" -o ${file -4} == ".jpg" ];
then
#do some exif related stuff here.
else
#throw some errors
fi
done
Upon execution, bash keeps throwing a an error on the if line: "syntax error near unexpected token `if'.
I'm a completely new to scripting; what is wrong with my if statement?
Thanks.
${file::-5}, what you are doing${file -5}won't work.