Debian Codegraph @

samples/inputmenu4

raw symbols SCIP
1 #! /bin/sh
2 # $Id: inputmenu4,v 1.12 2020/11/26 00:28:24 tom Exp $
3 #
4 # "inputmenu1" with a different label for the extra-button
5
6 . ./setup-vars
7
8 backtitle="An Example for the use of --inputmenu:"
9
10 ids=`id|sed -e 's/([^)]*)//g'`
11 uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'`
12 gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'`
13
14 user="$USER"
15 home="$HOME"
16
17 returncode=0
18 while test $returncode != 1 && test $returncode != 250
19 do
20 exec 3>&1
21 returntext=`$DIALOG --clear --ok-label "Create" \
22 --extra-label "Edit" \
23 --backtitle "$backtitle" "$@" \
24 --inputmenu "Originally I designed --inputmenu for a \
25 configuration purpose. Here is a possible piece of a configuration program." \
26 20 50 10 \
27 "Username:" "$user" \
28 "UID:" "$uid" \
29 "GID:" "$gid" \
30 "HOME:" "$home" \
31 2>&1 1>&3`
32 returncode=$?
33 exec 3>&-
34
35 case $returncode in
36 $DIALOG_CANCEL)
37 "$DIALOG" \
38 --clear \
39 --backtitle "$backtitle" \
40 --yesno "Really quit?" 10 30
41 case $? in
42 $DIALOG_OK)
43 break
44 ;;
45 $DIALOG_CANCEL)
46 returncode=99
47 ;;
48 esac
49 ;;
50 $DIALOG_OK)
51 "$DIALOG" \
52 --clear \
53 --backtitle "$backtitle" \
54 --msgbox "useradd \n\
55 -d $home \n\
56 -u $uid \n\
57 -g $gid \n\
58 $user" 10 40
59 ;;
60 $DIALOG_EXTRA)
61 tag=`echo "$returntext" |sed -e 's/^RENAMED //' -e 's/:.*//'`
62 item=`echo "$returntext" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'`
63
64 case "$tag" in
65 Username)
66 user="$item"
67 ;;
68 UID)
69 uid="$item"
70 ;;
71 GID)
72 gid="$item"
73 ;;
74 HOME)
75 home="$item"
76 ;;
77 esac
78 ;;
79
80 *)
81 . ./report-button
82 break
83 ;;
84
85 esac
86 done