Shell 脚本中让用户输入 yes

场景:让用户输入 yes 再执行下一步

read -p "Please type 'yes' to continue: " input 
if [ "$input" != "yes" ]; then 
    echo "You did not enter 'yes'. Exit..."
    exit 1
fi
posted @ 2024-04-25 23:29  op-timistic  阅读(188)  评论(0)    收藏  举报