#!/bin/bash
# Steven Maresca
# lightyear4 @t gmail 
#
# simple script to automate google queries from the CLI
# uses whatever browser you specify.
#
# note: characters like " must be escaped
#
# Current version of this script (and others) always available
# at http://www.fugitivethought.com/projects/shell-scripts/
#
# start google script

if [ $# -eq 0 ]
then
	echo " " 1>&2
	echo "Try again :-)" 1>&2
	echo "Sends search string(s) for google to the browser" 1>&2
	echo "of your choice (edit this script to alter).     " 1>&2
	echo "------------------------------------------------" 1>&2
	echo "Usage: `basename $0` SearchTerm1 SearchTerm2 ..." 1>&2
	echo "------------------------------------------------" 1>&2
	echo " " 1>&2
	exit 1
fi

for term in $@
do
	search="$search+$term"
done

url="http://www.google.com/search?q=$search"

echo "Searching $search" 1>&2

#uncomment your favorite browser or add your own
lynx "$url"
#elinks "$url"
#firefoxcheck "$url"

#http://www.google.com/search?hl=enO-8859-1&q=$1+$2+$3+$4&btnG=Google+Search

# end google search script
