Browse Source

ask_yn again

main
deicidus 1 year ago
parent
commit
1834857b92
  1. 4
      spells/cantrips/ask_yn

4
spells/cantrips/ask_yn

@ -11,7 +11,7 @@ else
fi
# Handle Ctrl-C
trap "printf '\n'; kill -s SIGINT $$" 2
trap "printf '\n'; exit 2" 2
# Use stty to make read command work for single character input
old_stty_cfg=$(stty -g)
@ -26,7 +26,7 @@ if [ -z "$answer" ]; then
fi
# Print the answer and return appropriate exit code
printf "%s\n" "$(echo $answer | tr a-z A-Z" >&2
printf "%s\n" "$(echo $answer | tr a-z A-Z)" >&2
sleep 0.01 # Without this, answer gets overwritten by next echo
if [ "$answer" = "Y" -o "$answer" = "y" ]; then
exit 0

Loading…
Cancel
Save