summaryrefslogtreecommitdiff
path: root/bin/extra/confirm
diff options
context:
space:
mode:
Diffstat (limited to 'bin/extra/confirm')
-rwxr-xr-xbin/extra/confirm12
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]"