Skip to content

Instantly share code, notes, and snippets.

@mattintosh4
Created November 9, 2012 10:21
Show Gist options
  • Save mattintosh4/4045012 to your computer and use it in GitHub Desktop.
Save mattintosh4/4045012 to your computer and use it in GitHub Desktop.
Google search form terminal
# --------------------------------------
# Google search from terminal
# --------------------------------------
ggr(){
_gU="$(echo $* | sed -e 's/^-[a-z] //' -e 's/ /+/g')"
_gU="https://www.google.co.jp/#hl=ja&safe=off&output=search&sclient=psy-ab&q=${_gU}&oq=${_gU}"
case $1 in
-c) _gA="/Applications/Google Chrome.app";;
-f) _gA="/Applications/Firefox.app";;
-s) _gA="/Applications/Safari.app";;
esac
_gC='open ${_gU} ${_gA:+-a} ${_gA}'
eval ${_gC} && eval echo ${_gC}
unset _g{A,C,U}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment