I am trying to make a bash function that will google last output of terminal $_
for me. For example when I try something and I get an error from terminal, instead of copy and pasting the error in google, I would just type google that
and it will google the error for me.
It will also support opening google home page and random google search.
function google() {
if [ $1 == 'that' ]
then
open /Applications/Google\ Chrome.app/ "http://www.google.com/search?q= $_";
elif [ $1 == '' ]
then
open /Applications/Google\ Chrome.app/ "http://www.google.com"
else
open /Applications/Google\ Chrome.app/ "http://www.google.com/search?q= $@";
fi
}
When I type google that
, I get search result for [
. I don't understand why it's not working?
I'm on OSX 10 and using Chrome.