Ok I'm trying to have a situation where I check if a file exists, if it does then I give the user the option to download it again - I want the default (enter) to be Y, I want Y or y to continue the script, I want N or n to exit the script, and I want all other responses to go back and re-prompt the question... but I'm stuck on that.
What I've done really just continues on (enter), and fails on all other responses other than lowercase y.
Here it is:
if [ -f $target/$remote_backup ];then
read -p "This file already exists, do you still want to download? [Y/n]" decide
if [ -z $decide ];then
# if you press return it'll default to Y and continue
decide="Y"
else
if [ $decide != y ]; then
echo "Ok you said no or pressed a random button, exiting"
exit -1
fi
fi
fi