From af354c5ea2c120ae79511aac4e21c94be57ae4df Mon Sep 17 00:00:00 2001
From: pgen
Date: Sun, 20 Mar 2016 11:11:08 +0100
Subject: Add a new example: yesno
---
examples/yesno/README | 1 +
examples/yesno/yesno.sh | 11 +++++++++++
2 files changed, 12 insertions(+)
create mode 100644 examples/yesno/README
create mode 100755 examples/yesno/yesno.sh
(limited to 'examples')
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
--
cgit v1.2.3