Google Search Script.
Skyie
Jun 03 2017

2  922 {{tagitem.name}}
In this tutorial i will be showing you guys, How to Google Search from you xShellz Shell (paid/free) (Note: Search limits on free shell)



1. Change directory to Home. (First thing you gotta do is change your directory to your Home/Main directory)

cd ~


2. Create a new File named "Google.sh". (Next, Create a new file where the script will be present)

> Google.sh


3. Edit the file "Google.sh". (Now edit the file using your favourite editor, In this tutorial we will be using Nano Editor)

nano Google.sh


4. Add the following Script to "Google.sh" (Now we will add the script to the text file through nano editor. Copy/Paste the following script down below to the Google.sh file.)

#--------------------------------------------------------------------------------------------------

#!/bin/bash


if [[ $(echo $*) ]]; then
searchterm="$*"
else
read -p "=> " searchterm
fi
searchterm=$(echo $searchterm | sed -e 's/\ /+/g')
lynx -dump http://www.google.com/search?q=$searchterm | les

#-------------------------------------------------------------------------------------------------

5. Save the Script to the file. (Now save the script to the file and exit from the editor)

CTRL+X (Hold Control Key and Press X)


6. Change the files access permissions to 777. (Now change the file access mode to 777, We use the command chmod to change/revoke a files permissions)

chmod 777 Google.sh


7. Autorun the Alias. (Now we will make an alias to execute the command and will let it autorun everytime the Terminal starts. To do this we will need to add a line to ~/.bashrc file in your directory)

nano ~/.bashrc


8. Add a new Alias. (Add the following alias script to your ~/.bashrc file)

alias google='echo "Google Search Script by Skyie/AutoBotIRC - #xshellz @ Freenode"; echo ""; echo -e " \e[34mG\e[31mo\e[33mo\e[34mg\e[32ml\e[31me \e[39mSearch"; ./google.sh'


9. Save the Script to the file. (Now save the script to the file and exit from the editor)

CTRL+X (Hold Control Key and Press X)


10. Execute the command google. (Now execute the google command from your terminal)

google
or
google serach_term_here (i.e google xshellz)




11. Exit/Close the Script. (To close/exit from the script:- )

CTRL+Z (Hold Control Key and Press Z)



Note: The output response language is based on your servers/shells location.



Have Doubts/Questions? Please comment down below on the post or email me at BLinuxYT[at]outlook.com
@Black Linux/Skyie/AutoBotIRC - Buuuuurp Geeky!
Nice work! Even less reason to leave the terminal now :)
jicjoc    Jun 06 2017
Thanks @jicjoc :). Subscribe to me for posting Updates!
Skyie    Jun 07 2017

Please Login or Sign Up to leave a reply.