xref: /freebsd/contrib/bsddialog/examples_utility/form.sh (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
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
17FORMS=$(./bsddialog --title " form " --form "Hello World!" 12 40 5 \
18	Label1:  1  1  Value1  1  9  18  25 \
19	Label2:  2  1  Value2  2  9  18  25 \
20	Label3:  3  1  Value3  3  9  18  25 \
21	Label4:  4  1  Value4  4  9  18  25 \
22	Label5:  5  1  Value5  5  9  18  25 \
233>&1 1>&2 2>&3 3>&-)
24
25case $? in
26	$BSDDIALOG_ERROR )
27		exit 1
28	;;
29	$BSDDIALOG_ESC )
30		echo "[ESC]"
31	;;
32	$BSDDIALOG_CANCEL )
33		echo "[Cancel]"
34	;;
35	$BSDDIALOG_OK )
36		echo "[OK]"
37	;;
38esac
39
40echo "$FORMS"
41