while
echo "Do you want to continue y/n?"
read install_to_default
[[ -z $install_to_default || $install_to_default != [yYnN] ]]
do echo "The response is invalid. A valid response is y or n."; done
Running the above script as root causes no problems, but when I try to run the script as a different user with the below changes it causes an infinite loop.
sudo -u piggy -i <<'EOF'
while
echo "Do you want to continue y/n?"
read install_to_default
[[ -z $install_to_default || $install_to_default != [yYnN] ]]
do echo "The response is invalid. A valid response is y or n."; done
EOF