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都可以。

posted @ 2020-06-11 14:11  TBHacker  阅读(706)  评论(0编辑  收藏  举报