mirror of https://git.envs.net/envs/burrow.git
better yesno function
This commit is contained in:
parent
21688e4fd9
commit
52ace7f214
7
burrow
7
burrow
|
@ -563,13 +563,14 @@ edit_config () {
|
||||||
}
|
}
|
||||||
|
|
||||||
yesno () {
|
yesno () {
|
||||||
printf "%s [yN]" "$1"
|
old_stty_cfg=$(stty -g)
|
||||||
read -r yn
|
stty raw -echo
|
||||||
|
yn=$(while ! head -c 1 | grep -i '[ny]'; do true; done)
|
||||||
|
stty "$old_stty_cfg"
|
||||||
case $yn in
|
case $yn in
|
||||||
y ) result=0 ;;
|
y ) result=0 ;;
|
||||||
* ) result=1 ;;
|
* ) result=1 ;;
|
||||||
esac
|
esac
|
||||||
printf "\n"
|
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue