Reputation: 1
I have been working on this script for hours trying to find out why it doesn't run, it keeps spitting out :
"program.sh: line 23: syntax error near unexpected token
fi'
program.sh: line 23:
fi
here is a copy of the script :
#!/bin/bash
#this is the program men
if [ $CHOICE = "1" ]; then
echo "removing old backup folder"
rm -rf ./AllBackUp
fi
echo "Backing up all files to ./Allbackup"
cp $PWD/* $PWD/AllBackUp
elif [ $CHOICE = "2" ]; then
if [ -d SelectBackup ];
rm -rf ./SelectBackup
fi
for f in $PWD; do
cp $PWD/$PATTERN $PWD/SelectBackup
done
help, I'm in a hole here!
Upvotes: 0
Views: 100
Reputation: 241881
Your second if
statement is missing a then
, so the fi
is, indeed, unexpected. (Bash is still expecting a then
.)
Upvotes: 1