File: inputbox6-8bit

package info (click to toggle)
dialog 1.0-20060221-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,040 kB
  • ctags: 1,239
  • sloc: ansic: 11,308; sh: 7,591; perl: 355; makefile: 238; python: 164
file content (29 lines) | stat: -rwxr-xr-x 538 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# $Id: inputbox6-8bit,v 1.1 2004/12/19 16:19:34 tom Exp $
: ${DIALOG=dialog}

tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15

. ./testdata-8bit

$DIALOG \
--title    `printf "$SAMPLE"` \
--inputbox `printf "$SAMPLE"` \
10 40 `printf "$SAMPLE"` 2>$tempfile

retval=$?

case $retval in
  0)
    echo "Input string is \"`cat $tempfile`\"";;
  1)
    echo "Cancel pressed.";;
  255)
    if test -s $tempfile ; then
      cat $tempfile
    else
      echo "ESC pressed."
    fi
    ;;
esac