Rev | Line | |
---|
[66] | 1 | #!/bin/sh |
---|
| 2 | # $Id: inputbox4,v 1.3 2004/09/12 22:38:08 tom Exp $ |
---|
| 3 | # An example which does not use temporary files, as suggested by Cary Evans: |
---|
| 4 | |
---|
| 5 | : ${DIALOG=dialog} |
---|
| 6 | $DIALOG --msgbox "goood" 0 0 |
---|
| 7 | $DIALOG --msgbox "goood1" 0 0 |
---|
| 8 | $DIALOG --msgbox "goood2" 0 0 |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$ |
---|
| 13 | trap "rm -f $tempfile" 0 1 2 5 15 |
---|
| 14 | |
---|
| 15 | $DIALOG --cr-wrap \ |
---|
| 16 | --title "INPUT BOX" --clear \ |
---|
| 17 | --inputbox \ |
---|
| 18 | "Hi, this is an input dialog box. You can use |
---|
| 19 | this to ask questions that require the user |
---|
| 20 | to input a string as the answer. You can |
---|
| 21 | input strings of length longer than the |
---|
| 22 | width of the input box, in that case, the |
---|
| 23 | input field will be automatically scrolled. |
---|
| 24 | You can use BACKSPACE to correct errors. |
---|
| 25 | |
---|
| 26 | Try entering your name below:" 0 0 2> $tempfile |
---|
| 27 | |
---|
| 28 | retval=$? |
---|
| 29 | |
---|
| 30 | case $retval in |
---|
| 31 | 0) |
---|
| 32 | #echo "Input string is `cat $tempfile`" |
---|
| 33 | $DIALOG --msgbox "Your message is `cat $tempfile`" 0 0 |
---|
| 34 | ;; |
---|
| 35 | 1) |
---|
| 36 | echo "Cancel pressed.";; |
---|
| 37 | 255) |
---|
| 38 | if test -s $tempfile ; then |
---|
| 39 | cat $tempfile |
---|
| 40 | else |
---|
| 41 | echo "ESC pressed." |
---|
| 42 | fi |
---|
| 43 | ;; |
---|
| 44 | esac |
---|
Note: See
TracBrowser
for help on using the repository browser.