-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind.sh
More file actions
executable file
·53 lines (47 loc) · 968 Bytes
/
find.sh
File metadata and controls
executable file
·53 lines (47 loc) · 968 Bytes
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
#!/bin/bash
types=($(ls -d algorithm/*) exit)
chosen="${types[0]}"
select t in "${types[@]}"; do
echo "You have chosen $t"
chosen="$t"
break
[[ $t == exit ]] && exit 0
done
query="ls $chosen -1"
freqs=( all high medium low )
level=( all medium easy hard )
queryEnd=" | awk -F '_' \"{gsub ( \"[lc]\", \"\") ; print \$1}\""
select t in "${freqs[@]}"; do
case $t in
all )
break
;;
high )
query=$query"| grep freqH" && break
;;
medium )
query=$query"| grep freqM" && break
;;
low )
query=$query"| grep freqL" && break
;;
*)
break
;;
esac
done
select l in "${level[@]}"; do
case $l in
all)
break
;;
*)
query=$query"| grep $l" && break
;;
esac
done
findresult () {
eval $query | awk -F "_" '{gsub ("[lc]", "") ; printf "%s%-50s%s%s%s\n","leetcode_", $0, "https://leetcode.com/problemset/all/?search=", $1, "&page=1"}'
}
findresult
exit 0