Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Google, Like man, but better?< Next Oldest | Next Newest >
SaidinUnleashed Offline





Group: Members
Posts: 1428
Joined: Mar. 2004
Posted: May 12 2005,04:22 QUOTE

I seem to find myself relying on google almost as much as I do man, especially from the console.

And it gets tiring to type "links google.com" then whatever I'm wanting to search for.

So I did what any good geek would do, and wrote a script.

Just toss it into /usr/sbin and it works just like man.

For example:
Code Sample
google linux small 50mb


would search google for the words linux, small, and 50mb.

I made it to work with up to 9 words, but it's easy to increase this, and I'm sure you will be able to figure it out. :P But I rarely search for more than 6 words, so I figure 9 is plenty for most people.

Anyways, enough talk. Here's the code:
Code Sample
#/bin/bash

# man-like clone that searches google
# created by SaidinUnleashed, aka J.P. Nimmo

s1=$1
s2=$2
s3=$3
s4=$4
s5=$5
s6=$6
s7=$7
s8=$8
s9=$9

exec links http://www.google.com/search?\&q\=$s1\+$s2\+$s3\+$s4\+$s5\+$s6\+$s7\+$s8\+$s9


Remember to save it as "google" , and as root, move it to /usr/sbin, then as root, chmod +x it to make it executable by everyone.

Hope you find this handy.

-J.P.


--------------
They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, cause if you play it forwards, it installs Windows.

Unleash the power of the TILDE~~~
Back to top
Profile PM AOL MSN YIM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: May 12 2005,15:18 QUOTE

Cool!

how about this...
Code Sample

EDIT: BROKEN!
QUERY="links http://www.google.com/search?&q="
for WORD in "$@"; do QUERY="$QUERY+$WORD"; done
exec "$QUERY" <-- quotes break it =op

no editing for additional parameters

EDIT:
That'll larn me to script something without testing....
Code Sample
QUERY="links http://www.google.com/search?&q="
for WORD in "$@"; do QUERY="$QUERY+$WORD"; done
QUERY=`echo "$QUERY"|sed 's/\"/\%22/g'`
exec $QUERY

if you use a phrase with escaped quotes it will translate the quote into the URL:
google something \"something else\" blah


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
1 replies since May 12 2005,04:22 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Google

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code