art with code

2008-11-12

A small shell script for Googling

google_raw.rb works like this:

$ google_raw -n1 euribor
Euribor Homepage
http://www.euribor.org/
Euribor (Euro Interbank Offered Rate) is the rate at which euro interban
k term deposits within the euro zone are offered by one prime bank to ano
ther prime ...Historical DataAbout EuriborAbout EoniaPress ReleasesWhat's
newFAQsPanel BanksTechnical FeaturesMore results from euribor.org??

$ google_raw -n1 ピース
ピース - Wikipedia
http://ja.wikipedia.org/wiki/%E3%83%94%E3%83%BC%E3%82%B9
出典: フリー百科事典『ウィキペディア(Wikipedia)』. 移動: ナビゲーション, 検索. ピース. Peace(ピース)は、英語で「平和
」を意味する。 Piece(ピース)は、同じく英語で「欠片」を意味する。 ピース ( タバコ) - 日本の煙草の銘柄のひとつ。 ...

And a google shell script to page the output:

google_raw $@ | less

[edit] Thanks to Anonymous for the $@ tip.

Coupled with URxvt's URL matcher, I can google stuff from the shell and click on the links to open them in Firefox. It's not all that useful though, since one tends to have a browser window open at all times anyhow.

2 comments:

Anonymous said...

You can use "$@" instead of $1 $2 ... $n in most shells, I think.

Ilmari Heikkinen said...

Thanks for the tip, I didn't know that. Updated the snippet to use $@ instead.

Blog Archive