fix yes_or_no function

This commit is contained in:
piotr 2023-06-20 02:42:39 +02:00
parent 72aca9284d
commit aabe39c0d5

View File

@ -5,12 +5,15 @@ if [ "$(id -u)" == 0 ] ; then
exit 1
fi
# Don't continue script if any error occurs.
set -e
function yes_or_no {
while true; do
read -r -p "$* [y/n]: " yn
case $yn in
[Yy]*) choice="Y" ; return 0 ;;
[Nn]*) choice="n" ; return 1 ;;
[Nn]*) choice="n" ; return 0 ;;
esac
done
}