|
|
@ -16,9 +16,9 @@ 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) |
|
|
|
stty raw -echo |
|
|
|
stty raw -echo |
|
|
|
printf "%s" "$prompt" |
|
|
|
printf "%s" "$prompt" >&2 |
|
|
|
answer=$( while ! head -c 1 | grep -i '[yn]'; do true; done ) |
|
|
|
answer=$( while ! head -c 1 | grep -i '[yn]'; do true; done ) |
|
|
|
stty "$old_stty_cfg" |
|
|
|
stty "$old_stty_cfg" >&2 |
|
|
|
|
|
|
|
|
|
|
|
# If no answer is given, use the default answer |
|
|
|
# If no answer is given, use the default answer |
|
|
|
if [ -z "$answer" ]; then |
|
|
|
if [ -z "$answer" ]; then |
|
|
|