diff options
-rw-r--r-- | examples/yesno/README | 1 | ||||
-rwxr-xr-x | examples/yesno/yesno.sh | 11 |
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 |