How do I prompt for Yes/No/Cancel input in a Linux shell script?

后端 未结 30 1718
不思量自难忘°
不思量自难忘° 2020-11-22 04:52

I want to pause input in a shell script, and prompt the user for choices.
The standard Yes, No, or Cancel type question.
How d

30条回答
  •  再見小時候
    2020-11-22 05:17

    read -p "Are you alright? (y/n) " RESP
    if [ "$RESP" = "y" ]; then
      echo "Glad to hear it"
    else
      echo "You need more bash programming"
    fi
    

提交回复
热议问题