Reading Macintosh

Apr 24, 2003 03:24 # 11007

jdonnell *** posts about...

A shell script that opens a search in google

96% | 2

This is a little script I wrote that I thought someone else might find usefull. I do a lot of work from the terminal and this script saves me a little bit of time here and there. It will open your default browser and do a search in google on the terms you passed from the terminal.
From the terminal type:

google your search terms

where 'your search terms' is what you want to search for.

I don't think this will work in linux. I don't believe linux has the open command, but I'm not really sure.

I can give more detailed instructions if anyone needs more help.

#!/bin/bash

if [ $# -eq 0 ]
then
    echo "Usage: chkargs argument..." 1>&2
    exit 1
fi

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

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

Apr 24, 2003 06:50 # 11015

marc ** replies...

Re: A shell script that opens a search in google

?% | 2

I don't think this will work in linux. I don't believe linux has the open command, but I'm not really sure.

Linux has an "open" command, but it does something completely different. To use your script on linux, you can substitute "open" with your favourite browser's name, such as:

/usr/bin/mozilla ${url} &

-marc

Apr 25, 2003 16:42 # 11070

jdonnell *** replies...

Thanks

Thanks


Favorites (edit)

Small text Large text

Netalive Amp (Skin for Winamp)