xref: /freebsd/contrib/bsddialog/examples_utility/passwordbox.sh (revision c7a063741720ef81d4caa4613242579d12f1d605)
1#!/bin/sh
2#-
3# SPDX-License-Identifier: CC0-1.0
4#
5# Written in 2021 by Alfonso Sabato Siciliano.
6#
7# To the extent possible under law, the author has dedicated all copyright
8# and related and neighboring rights to this software to the public domain
9# worldwide. This software is distributed without any warranty, see:
10#	<http://creativecommons.org/publicdomain/zero/1.0/>.
11
12: ${BSDDIALOG_ERROR=255}
13: ${BSDDIALOG_OK=0}
14: ${BSDDIALOG_CANCEL=1}
15: ${BSDDIALOG_ESC=5}
16
17FORM=$(./bsddialog --insecure --title " password " \
18	--passwordbox "Hello World!" 12 40 \
193>&1 1>&2 2>&3 3>&-)
20
21case $? in
22	$BSDDIALOG_ERROR )
23		exit 1
24	;;
25	$BSDDIALOG_ESC )
26		echo "[ESC]"
27	;;
28	$BSDDIALOG_CANCEL )
29		echo "[Cancel]"
30	;;
31	$BSDDIALOG_OK )
32		echo "[OK]"
33	;;
34esac
35
36echo "$FORM"
37