shell 判断是否继续
InstallWhileHostsExist=""
Echo_Yellow "Do you want to continue install?"
read -p "Default continue,Enter your choice [Y/n]: " InstallWhileHostsExist
case "${InstallWhileHostsExist}" in
[yY][eE][sS] | [yY])
echo "You will continue Install!"
;;
[nN][oO] | [nN])
echo "exit!"
;;
*)
echo "No input, will continue Install."
;;
esac
if [[ $InstallWhileHostsExist == 'n' ]]; then
exit 1
fi
很实用!输入Y,Yes,yes都可以。
输入N,n,No,NO都可以。