diff options
| author | Marc Vertes <mvertes@free.fr> | 2025-05-14 16:08:32 +0200 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2025-05-14 16:08:32 +0200 |
| commit | a87308d327d3fcef6dd2b522cfbb740881d2ad89 (patch) | |
| tree | 988bb778dafe2babfa00bcf71830294b967ed5c4 /bin | |
| parent | c35ad364ec95e1fb3014b72493156f9adc5a7bae (diff) | |
add bin/search
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/search | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/search b/bin/search new file mode 100755 index 0000000..2152592 --- /dev/null +++ b/bin/search @@ -0,0 +1,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")" |
