1#! /bin/sh 2# $Id: form2,v 1.9 2010/01/13 10:53:11 tom Exp $ 3 4. ./setup-vars 5 6backtitle="An Example for the use of --form:" 7 8ids=`id|sed -e 's/([^)]*)//g'` 9uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` 10gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` 11 12user="$USER" 13home="$HOME" 14 15returncode=0 16while test $returncode != 1 && test $returncode != 250 17do 18exec 3>&1 19value=`$DIALOG --ok-label "Submit" \ 20 --backtitle "$backtitle" "$@" \ 21 --form "Here is a possible piece of a configuration program." \ 220 0 10 \ 23 "1 Username:" 1 1 "$user" 1 12 10 10 \ 24 "1 UID:" 2 1 "$uid" 2 12 10 10 \ 25 "1 GID:" 3 1 "$gid" 3 12 10 10 \ 26 "1 HOME:" 4 1 "$home" 4 12 10 10 \ 27 "2 Username:" 5 1 "$user" 5 12 10 10 \ 28 "2 UID:" 6 1 "$uid" 6 12 10 10 \ 29 "2 GID:" 7 1 "$gid" 7 12 10 10 \ 30 "2 HOME:" 8 1 "$home" 8 12 10 10 \ 31 "3 Username:" 9 1 "$user" 9 12 10 10 \ 32 "3 UID:" 10 1 "$uid" 10 12 10 10 \ 33 "3 GID:" 11 1 "$gid" 11 12 10 10 \ 34 "3 HOME:" 12 1 "$home" 12 12 10 10 \ 35 "4 Username:" 13 1 "$user" 13 12 10 10 \ 36 "4 UID:" 14 1 "$uid" 14 12 10 10 \ 37 "4 GID:" 15 1 "$gid" 15 12 10 10 \ 38 "4 HOME:" 16 1 "$home" 16 12 10 10 \ 39 "5 Username:" 17 1 "$user" 17 12 10 10 \ 40 "5 UID:" 18 1 "$uid" 18 12 10 10 \ 41 "5 GID:" 19 1 "$gid" 19 12 10 10 \ 42 "5 HOME:" 20 1 "$home" 20 12 10 10 \ 43 "6 Username:" 21 1 "$user" 21 12 10 10 \ 44 "6 UID:" 22 1 "$uid" 22 12 10 10 \ 45 "6 GID:" 23 1 "$gid" 23 12 10 10 \ 46 "6 HOME:" 24 1 "$home" 24 12 10 10 \ 47 "7 Username:" 25 1 "$user" 25 12 10 10 \ 48 "7 UID:" 26 1 "$uid" 26 12 10 10 \ 49 "7 GID:" 27 1 "$gid" 27 12 10 10 \ 50 "7 HOME:" 28 1 "$home" 28 12 10 10 \ 512>&1 1>&3` 52returncode=$? 53exec 3>&- 54 55show=`echo "$value" |sed -e 's/^/ /'` 56 57 case $returncode in 58 $DIALOG_CANCEL) 59 "$DIALOG" \ 60 --clear \ 61 --backtitle "$backtitle" \ 62 --yesno "Really quit?" 10 30 63 case $? in 64 $DIALOG_OK) 65 break 66 ;; 67 $DIALOG_CANCEL) 68 returncode=99 69 ;; 70 esac 71 ;; 72 $DIALOG_OK) 73 "$DIALOG" \ 74 --clear \ 75 --backtitle "$backtitle" --no-collapse --cr-wrap \ 76 --msgbox "Resulting data:\n\ 77$show" 0 0 78 ;; 79 *) 80 echo "Return code was $returncode" 81 exit 82 ;; 83 esac 84done 85