xref: /freebsd/contrib/bsddialog/examples_utility/yesno.sh (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
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_YES=0}
14: ${BSDDIALOG_NO=1}
15: ${BSDDIALOG_ESC=5}
16
17./bsddialog --title " yesno " --yesno "Hello World!" 6 25
18
19case $? in
20	$BSDDIALOG_ERROR )
21		exit 1
22	;;
23	$BSDDIALOG_ESC )
24		echo "[ESC]"
25	;;
26	$BSDDIALOG_NO )
27		echo "[NO]"
28	;;
29	$BSDDIALOG_YES )
30		echo "[YES]"
31	;;
32esac
33