8

syntax error near unexpected token `if'

view full story
linux-howto

http://stackoverflow.com – 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. (HowTos)