-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreppy
More file actions
executable file
·49 lines (45 loc) · 1.03 KB
/
greppy
File metadata and controls
executable file
·49 lines (45 loc) · 1.03 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
#!/bin/sh
# errors dont seem to show up in everything
# move lines input into while loop
# add options to cat the various sub categories
greppy_taily() {
doas tail -n "$1" /var/log/socklog/everything/current | grep "$2"
}
echo " "
printf "tail length: "
read taily
while true; do
echo " "
echo "choose string:"
echo " "
echo " [n] nftables"
echo " [m] mpd"
echo " [e] error"
echo " [l] login"
echo " [c] custom"
echo " [x] exit"
echo " "
printf "choice: "
read choice
case "$choice" in
n) greppy="nftables" ;;
m) greppy="mpd" ;;
e) greppy="error" ;;
l) greppy="login" ;;
c)
printf "enter item to grep: "
read greppy
;;
x)
echo "goodbye..."
exit 0
;;
*)
echo "invalid option"
continue
;;
esac
echo " "
echo "checking for [ $greppy ] in last [ $taily ] lines"
greppy_taily "$taily" "$greppy"
done