Browse Source

ask_yn again

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

4
spells/cantrips/ask_yn

@ -11,7 +11,7 @@ else
fi fi
# Handle Ctrl-C # 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 # Use stty to make read command work for single character input
old_stty_cfg=$(stty -g) old_stty_cfg=$(stty -g)
@ -26,7 +26,7 @@ if [ -z "$answer" ]; then
fi fi
# Print the answer and return appropriate exit code # 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 sleep 0.01 # Without this, answer gets overwritten by next echo
if [ "$answer" = "Y" -o "$answer" = "y" ]; then if [ "$answer" = "Y" -o "$answer" = "y" ]; then
exit 0 exit 0

Loading…
Cancel
Save