The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 07-24-2008
Kiint Kiint is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 6
Even modifying for various shell stupidity doesnt help

./filter.sh: line 17: syntax error near unexpected token `fi'
./filter.sh: line 17: ` fi'

Code:
#!/bin/bash -x

for file in *.jpg; do

YY = "echo $file | awk '{split($0,a,""); print a[1]a[2]}'"
MM = "echo $file | awk '{split($0,a,""); print a[3]a[4]}'"
DD = "echo $file | awk '{split($0,a,""); print a[5]a[6]}'"
HH = "echo $file | awk '{split($0,a,""); print a[7]a[8]}'"

if [ -d $YY ]; then
        if [ -d $YY/$MM ]; then
                if [ -d $YY/$MM/$DD ]; then
                        if [ -d $YY/$MM/$DD/$HH ]; then
                                mv $YY$MM$DD$HH*.jpg $YY/$MM/$DD/$HH/$file
                        elif
                                mkdir $YY/$MM/$DD/$HH
                        fi
                elif
                        mkdir $YY/$MM/$DD
                fi
        elif
                mkdir $YY/$MM
        fi
elif
        mkdir $YY
fi

done