Initial import from FreeBSD RELENG_4:
[games.git] / gnu / usr.bin / dialog / TESTS / menubox
1 #!/bin/sh
2 DIALOG=${DIALOG=/usr/bin/dialog}
3
4 $DIALOG --clear --title "MENU BOX" \
5         --hline "Press 1-9, Up/Down, first letter or Enter" \
6         --menu "Hi, this is a menu box. You can use this to \n\
7 present a list of choices for the user to \n\
8 choose. If there are more items than can fit \n\
9 on the screen, the menu will be scrolled. \n\
10 You can use the UP/DOWN arrow keys, the first \n\
11 letter of the choice as a hot key, or the \n\
12 number keys 1-9 to choose an option.\n\
13 Try it now!\n\n\
14           Choose the OS you like:" -1 -1 4 \
15         "FreeBSD" "A Real Operating System for Real Users" \
16         "Linux"  "Another free Unix Clone for 386/486" \
17         "OS/2" "IBM OS/2" \
18         "WIN NT" "Microsoft Windows NT" \
19         "PCDOS"  "IBM PC DOS" \
20         "MSDOS"  "Microsoft DOS" 2> /tmp/menu.tmp.$$
21
22 retval=$?
23
24 choice=`cat /tmp/menu.tmp.$$`
25 rm -f /tmp/menu.tmp.$$
26
27 case $retval in
28   0)
29     echo "'$choice' chosen.";;
30   1)
31     echo "Cancel pressed.";;
32   255)
33     [ -z "$choice" ] || echo $choice ;
34     echo "ESC pressed.";;
35 esac