diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-30 08:23:45 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-30 08:23:45 +0200 |
commit | 3f8594ee04d2a3d9b40a259daf3b564a53b510fa (patch) | |
tree | 66ed50643cdc81af813b5771a99732d0f78bb618 /bin/extra/confirm | |
parent | 45d39ae0c67bb086f4df0c366b251e06c888408d (diff) | |
parent | 333aaf38c66a1e4ba41d3acea38b21613c0075b2 (diff) |
Merge branch 'main' of db: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]" |