A google search shellscript


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting A google search shellscript
# 1  
A google search shellscript

This little doey allows you do fire up a google search right from your terminal.

---------------------------------------------------

#!/bin/sh
#(save me into the path as "google")
clear &&
for i in "$@";
do lynx http://www.google.com/search?q="$@";
done

---------------------------------------------------

(the browser doesn't have to be lynx, it could be netscape, links, or whatever it just has to be able to accept urls from the command line)

you can then search google from the terminal using

google "your search for whatever"

Smilie
# 2  
That's a great idea - thanks

Smilie
# 3  
It can be shorter like this>>

#!/bin/bash
read do
lynx www.google.com/search?q="$do";


booom
Smilie Smilie Smilie Smilie
# 4  
You should probably change the spaces in the search query to "+" and + to "%2B":
Code:
lynx "http://www.google.com/search?q=$(echo $@|sed -e 's/+/%2B/g' -e 's/ /+/g')"

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #903
Difficulty: Medium
There are less than 10 million lines of code in the Linux kernel as of 2018.
True or False?

5 More Discussions You Might Find Interesting

1. What is on Your Mind?

YouTube: Search Engine Optimization | How To Fix Soft 404 Errors and A.I. Tales from Google Search

Getting a bit more comfortable making quick YT videos in 4K, here is: Search Engine Optimization | How To Fix Soft 404 Errors and A.I. Tales from Google Search Console https://youtu.be/I6b9T2qcqFo (0 Replies)
Discussion started by: Neo
0 Replies

2. What is on Your Mind?

Google Site Search in Search Drop Down Menu (Again)

Have just added (after missing for some time), the latest version of Google Site Search for our site in the Navbar Search Menu: https://www.unix.com/members/1-albums215-picture791.png Cheers and Enjoy. Here is the URL for that link in case you need it: https://goo.gl/P8p82c (4 Replies)
Discussion started by: Neo
4 Replies

3. What is on Your Mind?

Changes to Google Site Search Location

We are going to move the Google Site Search that is located in the upper right hand corner of the site to the toolbar. Both are showing at the moment, and the plans is to create a UserCP option to "turn on" the Google Site Search where it is currently showing for users who prefer not to use the... (2 Replies)
Discussion started by: Neo
2 Replies

4. UNIX for Advanced & Expert Users

google search changes with an underscore

How does adding an underscore change a google search? I was searching for John Elway and got different results with and without an unscore. (3 Replies)
Discussion started by: cokedude
3 Replies

5. Web Development

Google search appliance

Please let me know if Google search appliance supports JSON or XML interface? If yes please provide some references (3 Replies)
Discussion started by: uunniixx
3 Replies

Featured Tech Videos