diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-14 11:50:41 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-14 11:50:41 +0200 |
commit | 67a2df82d25f52ea0937f4eed355546deae7b4b5 (patch) | |
tree | 40bc358a6d2a6b119e04229b48fd05dd74a5b81d /bin/extra/confirm | |
parent | 4fbb921cd8a9da0135e0ddf54da898e080cc8c7e (diff) | |
parent | b0ef0738b3f0cebde9ed6b1d40ca0f7cbb1385a3 (diff) |
Merge branch 'main' of /var/git/dotfiles
Diffstat (limited to 'bin/extra/confirm')
-rwxr-xr-x | bin/extra/confirm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/extra/confirm b/bin/extra/confirm new file mode 100755 index 0000000..116b468 --- /dev/null +++ b/bin/extra/confirm @@ -0,0 +1,12 @@ +#!/bin/sh + +read_char () +{ + old_stty_cfg=$(stty -g 2> /dev/null) + stty raw -echo 2> /dev/null + dd ibs=1 count=1 2> /dev/null + stty $old_stty_cfg 2> /dev/null +} + +>&2 printf "$1 " +read_char | grep -q "[yY]" |