-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.sh
executable file
·93 lines (81 loc) · 2.09 KB
/
main.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# A menu driven shell script sample template
## ----------------------------------
# Step #1: Define variables
# ----------------------------------
EDITOR=vim
PASSWD=/etc/passwd
RED='\033[0;41;30m'
STD='\033[0;0;39m'
clear
logo(){
cat <<'EOF'
__ __ _ _ ____ _
| \/ | | (_) | _ \ | |
| \ / | ___ __| |_ __ _ | |_) |_ __ _ _| |_ ___
| |\/| |/ _ \/ _` | |/ _` | | _ <| '__| | | | __/ _ \
| | | | __/ (_| | | (_| | | |_) | | | |_| | || __/
|_| |_|\___|\__,_|_|\__,_| |____/|_| \__,_|\__\___|
}----{+} Coded By S1rwolf {+}----{
EOF
}
# ----------------------------------
# Step #2: User defined function
# ----------------------------------
pause(){
read -p "Press [Enter] key to continue..." fackEnterKey
}
one(){
chmod +x instagram.py
python3 instagram.py
pause
}
two(){
chmod +x facebook.py
python3 facebook.py
pause
}
three(){
chmod +x twitter.py
python3 stwitter.py
pause
}
# function to display menus
show_menus() {
echo " "
echo "{1}--Instagram"
echo "{2}--Facebook"
echo "{3}--Twitter"
echo " "
echo "{99} Exit"
echo " "
}
# read input from the keyboard and take a action
# invoke the one() when the user select 1 from the menu option.
# invoke the two() when the user select 2 from the menu option.
# Exit when user the user select 3 form the menu option.
read_options(){
local choice
read -p "Enter choice [ 1 - 3] : " choice
case $choice in
1) one ;;
2) two ;;
3) three ;;
99) exit 0;;
*) echo -e "${RED}Error...${STD}" && sleep 2
esac
}
# ----------------------------------------------
# Step #3: Trap CTRL+C, CTRL+Z and quit singles
# ----------------------------------------------
trap '' SIGINT SIGQUIT SIGTSTP
# -----------------------------------
# Step #4: Main logic - infinite loop
# ------------------------------------
while true
do
clear
logo
show_menus
read_options
done