summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2016-03-20 11:11:08 +0100
committerpgen <p.gen.progs@gmail.com>2016-03-20 11:11:08 +0100
commitaf354c5ea2c120ae79511aac4e21c94be57ae4df (patch)
tree65a7f3d10f2ec72d33652825b0d68c4105605e9f
parentcf5d139a2e00c7af8c8557f32e451db4655e02b5 (diff)
Add a new example: yesno
-rw-r--r--examples/yesno/README1
-rwxr-xr-xexamples/yesno/yesno.sh11
2 files changed, 12 insertions, 0 deletions
diff --git a/examples/yesno/README b/examples/yesno/README
new file mode 100644
index 0000000..66877fd
--- /dev/null
+++ b/examples/yesno/README
@@ -0,0 +1 @@
+Whith this example you will discover how easily you can ask a user to confirm a previous choice
diff --git a/examples/yesno/yesno.sh b/examples/yesno/yesno.sh
new file mode 100755
index 0000000..11e9ffb
--- /dev/null
+++ b/examples/yesno/yesno.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+RES=$(
+ ../../smenu -2 ^Y -1 ^N -3 ^C -s /^N -m "Please confirm your choice:" \
+ <<< "YES NO CANCEL"
+ )
+
+[[ -z "$RES" ]] && echo "'q' was hit, exiting without selecting anything" \
+ || echo "You selected: $RES"
+
+exit 0