#!/bin/bash # Move wallpapers to wallpaper folder while removing spaces. ONE=1 # For getting singular/plural right (see below). number=0 # Keeps track of how many files actually renamed. FOUND=0 # Successful return value. for filename in * #Traverse all files in directory. do if [ "$filename" = "000_Proccess_New_Walls" ] #Watch out for this program then ONEZY=1 else if [ "$filename" = "000_Proccess_New_Walls~" ] #Watch out for this program then ONEZYZY=1 else echo "$filename" | grep -q " " # Check whether filename if [ $? -eq $FOUND ] #+ contains space(s). then fname=$filename # Yes, this filename needs work. newlocation=`echo $fname | sed -e "s/ /_/g"` # Substitute underscore for blank. else newlocation=$filename fi width=`identify -format '%w' $filename` #get image width height=`identify -format '%h' $filename` #get image height if [ $height -ge 700 ] then #is in first standard? if [ $width -ge 1000 ] then #is in last standard? let "number += 1" #we are proccesing a file mv "$filename" "../walls/$newlocation" #move it echo "Image moved successfully : $filename" #output of success else #whats wrong here? echo "Standards not met in Image: $filename" #no like fi else echo "Standards not met in Image: $filename" #no like fi fi fi done if [ "$number" -eq "$ONE" ] # For correct grammar. then echo "$number file moved." else echo "$number files moved." fi read -p "Files remaining did not meet standards. done." d #just to see what the output was... exit 0
and output is:
vzybilly@computer:/new_walls$ ./000_Proccess_New_Walls ./000_Proccess_New_Walls: line 33: syntax error near unexpected token `else' ./000_Proccess_New_Walls: line 33: ` else #whats wrong here?'
I can't see anything wrong here but I've only recently started with bash...

New Topic/Question
Reply




MultiQuote



|