Is there any way to create a script or a program that will open firefox, go onto google and search for the arguments passed to it ?
So something like
google How do I shoot web
should open Firefox with http://www.google.com/search?q=How+do+I+shoot+web
I found this script
google() {
search=""
echo "Googling: $@"
for term in $@; do
search="$search%20$term"
done
xdg-open "http://www.google.com/search?q=$search"
}
but I need to paste it into the terminal each time I want to use it …
So basically, what do I have to do to make the above script work without having to paste it into the terminal every time ?
Best Answer
Just paste the below function inside
~/.bashrc
file and then source(source ~/.bashrc
) it.After that you can open google search page directly by
google search-string
command without pasting the above function everytime on terminal.