aboutsummaryrefslogtreecommitdiff
path: root/contrib/bsddialog/examples_utility/passwordform.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bsddialog/examples_utility/passwordform.sh')
-rwxr-xr-xcontrib/bsddialog/examples_utility/passwordform.sh30
1 files changed, 27 insertions, 3 deletions
diff --git a/contrib/bsddialog/examples_utility/passwordform.sh b/contrib/bsddialog/examples_utility/passwordform.sh
index 658f1635dffc..19b3a355b6eb 100755
--- a/contrib/bsddialog/examples_utility/passwordform.sh
+++ b/contrib/bsddialog/examples_utility/passwordform.sh
@@ -3,15 +3,39 @@
# SPDX-License-Identifier: CC0-1.0
#
# Written in 2021 by Alfonso Sabato Siciliano.
+#
# To the extent possible under law, the author has dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty, see:
-# <http://creativecommons.org/publicdomain/zero/1.0/>.
+# <http://creativecommons.org/publicdomain/zero/1.0/>.
+
+: ${BSDDIALOG_ERROR=255}
+: ${BSDDIALOG_OK=0}
+: ${BSDDIALOG_CANCEL=1}
+: ${BSDDIALOG_ESC=5}
-./bsddialog --insecure --title " passwordform " --passwordform "Example" 12 40 5 \
+FORMS=$(./bsddialog --insecure --title " passwordform " \
+ --passwordform "Example" 12 40 5 \
Password1: 1 1 "" 1 12 18 25 \
Password2: 2 1 "" 2 12 18 25 \
Password3: 3 1 "" 3 12 18 25 \
Password4: 4 1 "" 4 12 18 25 \
Password5: 5 1 "" 5 12 18 25 \
- 2>out.txt ; cat out.txt ; rm out.txt
+3>&1 1>&2 2>&3 3>&-)
+
+case $? in
+ $BSDDIALOG_ERROR )
+ exit 1
+ ;;
+ $BSDDIALOG_ESC )
+ echo "[ESC]"
+ ;;
+ $BSDDIALOG_CANCEL )
+ echo "[Cancel]"
+ ;;
+ $BSDDIALOG_OK )
+ echo "[OK]"
+ ;;
+esac
+
+echo "$FORMS"