-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmyhelp.sh
74 lines (69 loc) · 1.64 KB
/
myhelp.sh
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
#!/bin/bash
source helper_func.sh
source colours.sh
unix_help_main_menu() {
local selection
until [ "$selection" = "0" ]; do
center_text "${BGCOLOUR}MAIN MENU${ENDCOLOUR}" " "
echo -e "${COLOUR}1${ENDCOLOUR} -- File and Directory Management Commands"
echo -e "${COLOUR}2${ENDCOLOUR} -- Text Processing Commands"
echo -e "${COLOUR}3${ENDCOLOUR} -- System Status Commands"
echo -e "${COLOUR}4${ENDCOLOUR} -- Exit\n"
center_text_prompt "\b\b\b\b\b\b\bEnter your choice: " " "
read -n 1 -r selection
clear
case $selection in
1)
bash file_management.sh
;;
2)
bash text_processing.sh
;;
3)
bash system_status.sh
;;
q | 4)
exit 0
;;
*)
center_text "${RED}error: Enter correct choice [1-4]${ENDCOLOUR}"
selection=
;;
esac
done
}
expert_menu() {
clear
case "$1" in
help)
bash help.sh
;;
file)
bash file_management.sh
;;
text)
bash text_processing.sh
;;
status)
bash system_status.sh
;;
author)
echo "Soumik Dutta"
;;
*)
center_text "${RED}error: Enter correct argument [file, text, status, help] ... see help for details.${ENDCOLOUR}"
;;
esac
}
clear
if (($# == 0)); then
export MYHELP_MODE=novice
export COLOUR=$GREEN
export BGCOLOUR=$GREENBG
unix_help_main_menu
else
export MYHELP_MODE=expert
export COLOUR=$BLUE
export BGCOLOUR=$BLUEBG
expert_menu "$1"
fi