-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdialogexperiment
More file actions
executable file
·89 lines (73 loc) · 2.01 KB
/
dialogexperiment
File metadata and controls
executable file
·89 lines (73 loc) · 2.01 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
##################################################
#
# Matthew Page
# 04/03/2016
#
# dialogexperiment - this script is me playing
# with dialog attempting
# to learn it.
#
##################################################
##Old Test Code
#choice=$(dialog --backtitle "Matt's Bash Scripting" --nocancel --inputbox "Enter a number: " 20 40 3>&1 1>&2 2>&3)
##################################################
#
# Functions, Functions, Functions!!!
#
##################################################
##Quit function to break out of the whole program
function quit {
exit 0
}
##Function for Main Menu
function menu {
choice=$(dialog --backtitle "Matt's Bash Scripting" \
--title "Main Menu" \
--clear \
--nocancel \
--menu "Choose one" 30 50 4 \
"Users" "- Do something with users" \
"Passwords" "- Do stuff with passwords" \
"Groups" "- Do things with groups" \
"Quit" "- Exit to desktop" 3>&1 1>&2 2>&3)
if [ "$choice" != "Quit" ]; then
case $choice in
"Users")
users #calls users function
;;
"Passwords")
passwords #calls passwords function
;;
"Groups")
groups #calls groups function
;;
*)
echo "Something else. Where Am I?"
exit 1
;;
esac
else
echo "Quitting..."
quit
fi
}
function users {
echo "Entering Users sub-menu"
}
function passwords {
echo "Entering Passwords sub-menu "
}
function groups {
echo "Entering Groups sub-menu"
}
##################################################
#
# Main Menu
#
##################################################
menu
##Old code to probably be deleted
#clear
#echo "Your answer was $choice"
exit 0