Created
September 24, 2023 20:30
-
-
Save hosni/7097156335d8164de63f529798e8a07b to your computer and use it in GitHub Desktop.
Want to ask Yes/No question in shell?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read -r YN | |
YN=$(printf '%s' "$YN" | tr '[:upper:]' '[:lower:]') | |
case "$YN" in | |
y | yes ) | |
;; | |
* ) | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment