read -p "Do you want to .... [Y/N]? " yn while true; do case $yn in [Yy]|[Yy][Ee][Ss] ) break ;; [Nn]|[Nn][Oo] ) echo "exiting....." exit ;; * ) echo -n "Please type yes or no: " read yn ;; esac done
时间: 2024-10-31 23:59:19
read -p "Do you want to .... [Y/N]? " yn while true; do case $yn in [Yy]|[Yy][Ee][Ss] ) break ;; [Nn]|[Nn][Oo] ) echo "exiting....." exit ;; * ) echo -n "Please type yes or no: " read yn ;; esac done