Skip to content

Instantly share code, notes, and snippets.

@hosni
Created September 24, 2023 20:30
Show Gist options
  • Save hosni/7097156335d8164de63f529798e8a07b to your computer and use it in GitHub Desktop.
Save hosni/7097156335d8164de63f529798e8a07b to your computer and use it in GitHub Desktop.
Want to ask Yes/No question in shell?
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