我正在编写一个脚本来备份我的 CouchPotatoServer,但我遇到了问题。
这是我遇到问题的代码:
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
问题是用户选择一个选项并执行代码后,它一直在等待新的选择,但我希望它退出。我怎样才能做到这一点?