Created
March 16, 2015 09:34
-
-
Save inooid/ce1da5696432710e540b to your computer and use it in GitHub Desktop.
Google command to search on Google from the command line (Mac OS X)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command to open the webbrowser and immediately start searching | |
# for the right keyword. | |
# | |
# Usage: | |
# $ google test query | |
# $ => Opens the browser on http://www.google.com/search?q=test+query | |
# | |
google() | |
{ | |
local s="$_" | |
local query= | |
case "$1" in | |
'') ;; | |
that) query="search?q=${s//[[:space:]]/+}" ;; | |
*) s="$*"; query="search?q=${s//[[:space:]]/+}" ;; | |
esac | |
open /Applications/Google\ Chrome.app/ "http://www.google.com/${query}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment