It occurred to me that for Google searches where I don't need suggestions I can do a search by hitting a URL from the command line with this one-line shell script:
% cat gg open https://www.google.com/search?q="$*"
Let's make one for Wikipedia, too:
% cat wk open http://en.wikipedia.org/wiki/"$*"
Yup, I should generalize those to a script that looks at its name and maps that to an appropriate URL. Here it is:
% cat hitit which=$(basename $0) case $which in gg) url="https://www.google.com/search?q=$*" ;; wk) url="http://en.wikipedia.org/wiki/$*" ;; esac open "$url"
Let's add a couple of symlinks in my sbin directory:
$ ln -s hitit gg $ ln -s hitit wk
Now, instead of
- Switch to Chrome (I use cmd-, 3 with Keyboard Maestro)
- Type cmd-L to get to the address field
- Type the search string, or use a Chrome "search engine" like w to hit Wikipedia.
% gg astroboy % wk ruby lang
The above use open(1) on OS X but on Cygwin, which I may be moving back to, I'd hit URLs from the command line with this script:
% cat ffx "/c/Program Files/Mozilla Firefox/firefox.exe" $*