xref: /freebsd/contrib/bsddialog/examples_utility/rangebox.sh (revision 397e83df75e0fcd0d3fcb95ae4d794cb7600fc89)
1#!/bin/sh
2#-
3# SPDX-License-Identifier: CC0-1.0
4#
5# Written in 2023 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
17VALUE=$(./bsddialog --title " rangebox " --rangebox "Hello World!" 7 35 0 10 5 \
183>&1 1>&2 2>&3 3>&-)
19
20case $? in
21	$BSDDIALOG_ERROR )
22		exit 1
23	;;
24	$BSDDIALOG_ESC )
25		echo "[ESC]"
26	;;
27	$BSDDIALOG_CANCEL )
28		echo "[Cancel]"
29	;;
30	$BSDDIALOG_OK )
31		echo "[OK] Value: $VALUE"
32	;;
33esac
34