Debian Codegraph @

samples/inputmenu-stdout

raw symbols SCIP
1 #! /bin/sh
2 # $Id: inputmenu-stdout,v 1.17 2020/11/26 00:30:01 tom Exp $
3 # 2002 - written by Tobias Rittweiler <[email protected]>
4
5 . ./setup-vars
6
7 user="$USER"
8 uid=`id|sed -e 's/^uid=//' -e 's/(.*//'`
9 gid=`id|sed -e 's/^.*gid=//' -e 's/(.*//'`
10 home="$HOME"
11
12 while [ "${returncode:-99}" -ne 1 ] && [ "${returncode:-99}" -ne 250 ]; do
13 returntext=`$DIALOG \
14 --stdout --clear --ok-label "Create" \
15 --backtitle "An Example for the use of --inputmenu:" "$@" \
16 --inputmenu "Originally I designed --inputmenu for a \
17 configuration purpose. Here is a possible piece of a configuration program. \
18 " 20 50 10 \
19 "Username:" "$user" \
20 "UID:" "$uid" \
21 "GID:" "$gid" \
22 "HOME:" "$home" \
23 `
24 returncode=$?
25 case $returncode in
26 $DIALOG_CANCEL)
27 "$DIALOG" \
28 --clear --backtitle "An Example for the use of --inputmenu:" \
29 --yesno "Really quit?" 10 30
30 case $? in
31 $DIALOG_OK) break;;
32 $DIALOG_CANCEL) returncode=99;;
33 esac
34 ;;
35 $DIALOG_OK)
36 "$DIALOG" \
37 --clear --backtitle "An Example for the use of --inputmenu:" \
38 --msgbox "useradd \n\
39 -d $home \n\
40 -u $uid \n\
41 -g $gid \n\
42 $user" 10 40
43 ;;
44 $DIALOG_EXTRA)
45 value=`echo "$returntext" | sed -e 's/^RENAMED //'`
46 tag=`echo "$value" | sed -e 's/:.*//'`
47 item=`echo "$value" | sed -e 's/^[^:]*:[ ][ ]*//'`
48
49 case "$tag" in
50 Username) user="$item" ;;
51 UID) uid="$item" ;;
52 GID) gid="$item" ;;
53 HOME) home="$item" ;;
54 esac
55 ;;
56
57 *)
58 . ./report-button
59 break
60 ;;
61
62 esac
63 done