-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstring_search.sh
executable file
·204 lines (176 loc) · 6.09 KB
/
string_search.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
m=1
v1=1
clear
while [ $m == 1 ]
do
#-----------------------------------------------------------------------
if [ $v1 -le 7 ]
then
#espeak -g1 -s160 " How may i help you sir " -w foo.wav
#gnome-terminal -- ./interface.sh
./welcome.sh "$v1"
echo " "
read -p "Type here ..:" mp
#----------------------------------------------------------------------
a=($mp)
#echo "${a[@]}"
b=(hi jarvis hai hello name you myname yourname your my how are date time today firewall set activate on off deactivate power check level state info status brightness update open public port ngrok weather yourself myself system vulnerability cpu info information architecture details volume increase decrease clear all screen vlc start stop chrome google text editor gedit empty document search ipaddress ip local)
v=$(echo "${b[@]}" | wc -w)
s=$(echo "${a[@]}" | wc -w)
j=0
#echo "$b $v $s $a"
#ch=()
while [ $j -lt $s ]
do
i=0
while [ $i -lt $v ]
do
if [ "${a[j]}" == "${b[i]}" ]
then
ch=( "${ch[@]}" "${a[j]}" )
fi
i=$(( i+1 ))
done
j=$(( j+1 ))
done
#echo ${ch[@]}
echo ${ch[@]} | tr -d ' ' >> nn.txt
vv=$(cat nn.txt)
echo "$vv"
case "$vv" in
#-----------------------greetings---------------------------------------------------------
"myname" | "namemy" | "callme" | "myself")
espeak " Your name is $1" -w foo.wav
cc ./interface.sh
sleep 1
echo " Your name is $1"
;;
"yourname"| "yourself")
espeak -g2 " My name is Jarvis" -w foo.wav
gnome-terminal -- ./interface.sh
sleep 1
espeak -g2 " i am your voice Assistant" -w foo.wav
gnome-terminal -- ./interface.sh
sleep 1
;;
"howareyou")
espeak "i am fine thank you sir" -w foo.wav
gnome-terminal -- ./interface.sh
sleep 1
echo "i am fine thank you sir"
;;
"hello" | "hi" | "hai" | "jarvis" | "hijarvis" | "haijarvis" | "jarvishi" | "hellojarvis" )
espeak "Hello sir" -w foo.wav
gnome-terminal -- ./interface.sh
sleep 1
echo " hi sir"
;;
#----------------------- Services --------------------------------------------------------
"datetoday" | "todaydate" | "date" | "today")
./date_check.sh
;;
"time")
./time_check.sh
;;
"setfirewall" | "firewallset" | "activatefirewall" | "firewallactivate" | "onfirewall" | "firewallon")
./firewall.sh
;;
"deactivatefirewall" | "firewalldeactivate" | "firewalloff" | "offfirewall")
./deactivatefirewall.sh
;;
"powerinfo" | "powerstate" | "powerlevel" | "powercheck" | "checkpower" | "levelpower" | "statepower" | "infopower" | "powerstatus" | "statuspower" | "powerinformation" | "informationpower" | "powerdetails" | "detailspower"s)
./power_check.sh
;;
"brightnessupdate" | "updatebrightness" | "brightness")
./brightness_update.sh
;;
"publicport" | "openpublicport" | "publicportopen" | "openngrok" | "ngrokopen" | "ngrokport" | "portngrok")
gnome-terminal -- ./ngcheck.sh
;;
"checkweather" | "weathercheck" | "weather" | "weatherstatus" | "statusweather" | "weatherinfo" | "infoweather" | "weatherinformation" | "informationweather" | "weatherdetails"| "detailsweather")
./weather_update.sh
espeak "If you want to find weather status of other place" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
sleep 1
read -p "If you want to find weather status of another place [y/n]:" o
if [ "$o" == "y" ]
then
./weather_update.sh "$o"
fi
;;
"Systemvulnerability" | "vulnerabilitysystem" | "vulnerability")
./sys_vul.sh
;;
"systeminfo" | "systeminformation" | "systemarchitecture" | "architecturesystem" | "detailssystem" | "systemdetails" | "systemcpu" | "cpusystem" | "cpudetails" | "detailscpu" | "cpuinfo" | "infocpu" | "cpuarchitecture" | "architecturecpu" | "cpuinformation" | "informationcpu")
./system_cpu.sh
;;
"volume" | "increasevolume" | "decreasevolume" | "volumedecrease" | "volumeincrease" |"updatevolume" | "volumeupdate")
espeak "Enter volume level" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
sleep 1
read -p "Enter volume level:" o
./volume_update.sh "$o"
;;
"ip" | "ipaddress" | "localip" | "publicip")
./myip.sh
;;
#----------------------- applications --------------------------------------------------------
"vlc" |"openvlc" | "vlcopen" | "startvlc" | "vlcstart")
espeak "starting v l c" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
sleep 1
gnome-terminal -- vlc
;;
"googlechrome" | "chrome" | "chromegoogle" | "openchrome" | "startchrome" | "chromeopen" | "chromestart")
espeak "starting google chrome" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
sleep 1
gnome-terminal -- google-chrome
;;
"texteditor" | "opentexteditor" | "texteditoropen" | "starttexteditor" | "texteditorstart" | "gedit")
espeak "Opening G edit" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
sleep 1
gnome-terminal -- gedit
;;
"openemptydocument" | "startemptydocument" | "emptydocument" | "document")
espeak "Creating an empty document" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
sleep 1
touch new.txt
gnome-terminal -- gedit new.txt
;;
"searchdocument" | "documentsearch")
espeak "Enter the file name to search:" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
sleep 1
read -p "Enter the file name to search:" s
espeak "Searching for file $s" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
sleep 1
find . -type f -name "$s"
;;
#-----------------------others-----------------------------------------------------------
"clear" | "clearscreen" | "screenclear" | "clearall")
espeak "Clearing screen" -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
clear
;;
espeak "exiting.." -w foo.wav
vlc --fullscreen --effect-list=spectrometer foo.wav
"exit") exit
;;
*)
espeak " something went wrong please try again " -w foo.wav
gnome-terminal -- ./interface.sh
sleep 1
;;
esac
unset ch
rm nn.txt
v1=0
else
v1=1
fi
sleep 4
done