blob: 2152592b70d314f6c7050b941acc2f2bff3e27af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/sh
urlenc() {
LC_ALL=C awk -v s="$1" 'BEGIN {
for (i = 0; i < 256; i++) ord[sprintf("%c", i)] = i
len = length(s)
for (i = 1; i <= len; i++) {
c = substr(s, i, 1)
if (c ~ /[A-Za-z0-9]/) res = res c
else res = res sprintf("%%%02X", ord[c])
}
print res
exit
}'
}
exec open "https://www.google.com/search?udm=14&num=20&q=$(urlenc "$1")"
|