I am working on a script to back up my CouchPotatoServer, but I'm having problems.
Here is the code I am having problems with:
select OPTION in Backup Restore Finish; do
echo "You choose $OPTION CouchPotatoServer settings";
case $OPTION in
Backup)
echo "Backing up settings file to $CPBPATH:";
cp $CPSPATH/settings.conf $CPBPATH/settings-"$(date +%Y%m%d-%H%M)".bak ;
echo "Done!"
break
;;
Restore)
echo "Please choose a backup to restore settings" ;
AVAILABLEFILES="($(find $CPBPATH -maxdepth 1 -print0 | xargs -0))"
select FILE in $AVAILABLEFILES; do
cp "$FILE" $CPSPATH/settings.conf ;
echo "restored $FILE"
break
;;
done
The problem is that after the user chooses one option and the code is executed, it keeps waiting for a new selection, but I want it to exit. How can I do that?