-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/google
Copy pathMore file actions
52 lines (48 loc) · 1.26 KB
/google
File metadata and controls
52 lines (48 loc) · 1.26 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
50
51
52
google()
{
local query=""
local url=""
local browser=""
local debug_www=1
source "${HOME}/etc/browser.conf"
while getopts "gcb:s:u:" o ; do
case "o" in
g)
browser="${gui_browser}"
;;
c)
browser="${console_browser}"
;;
s)
search="${OPTARG}"
;;
u)
url="${OPTARG}"
;;
*)
echo "usage: $0 -[gc]|[-b browser] [-s search]|[-u url] site"
;;
esac
done
shift $((OPTIND-1))
if [ -n "${search}" ] && [ -n "${url}" ] ; then
echo "Invalid usage - only specify either -s or -u, not both."
return 1
fi
if [ -n "${search}" ] ; then
_site="https://www.google.com/search?q=${search//[[:space:]]/+}"
elif [ -n "${url}" ] ; then
_site="${url}"
else
_site="$*"
fi
[[ "$debug_www" -gt 1 ]] && echo "${browser}" "http://www.google.com/${query}"
open -a "${browser}" "http://www.google.com/${query}"
}
#wiki ()
#{
# browser=$(cat ${HOME}/etc/browser.txt)
#
# echo open "${browser}" "http://wikipedia.org/wiki/$*"
#}
# vim:ts=4:sts=4:ai:et:syntax=sh:ft=sh: