summaryrefslogtreecommitdiff
path: root/bin/extra/confirm
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-13 02:08:33 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-13 02:08:33 +0200
commit818dabae65e67cb52f11623ab1e76ad4c85c19e1 (patch)
tree5c508f03e2718fc786edb0ed82f9fab49bb00e97 /bin/extra/confirm
parent5eed72797eaf9ec0d0e43b24add8b266b1999b08 (diff)
added confirm, trl and wipe scripts!
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]"