xref: /freebsd/contrib/dialog/samples/menubox12 (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1#!/bin/sh
2# $Id: menubox12,v 1.6 2020/11/26 00:03:58 tom Exp $
3
4. ./setup-vars
5
6. ./setup-edit
7
8case "x$DIALOGOPTS" in
9*--no-items*|*--noitem*)
10	CUT="cut -d: -f1,3"
11	;;
12*)
13	CUT="cat"
14	;;
15esac
16
17$CUT >$input <<-EOF
18	Linux:The Great Unix Clone for 386/486
19	NetBSD:Another free Unix Clone for 386/486
20	OS/2:IBM OS/2
21	WIN NT:Microsoft Windows NT
22	PC-DOS:IBM PC DOS
23	MS-DOS:Microsoft DOS
24EOF
25sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' <$input >$output
26cat $output >$input
27
28$DIALOG --clear --title "MENU BOX" "$@" \
29        --menu "Hi, this is a menu box. You can use this to \n\
30present a list of choices for the user to \n\
31choose. If there are more items than can fit \n\
32on the screen, the menu will be scrolled. \n\
33You can use the UP/DOWN arrow keys, the first \n\
34letter of the choice as a hot key, or the \n\
35number keys 1-9 to choose an option.\n\
36Try it now!\n\n\
37	Choose the OS you like:" 20 51 4 \
38	--file $input 2> $output
39
40returncode=$?
41
42tempfile=$output
43. ./report-tempfile
44