This is my first post and first script. Just finished my first Linux class and I'm trying to put it all into practice. Accepting all criticism and help, TIA!
I am writing a script that would
1) Open my web browser
2) Search a random word using bing search, selected randomly from the dictionary
3) Wait 5 - 10 seconds then search another random word, repeating roughly 20 - 30 times
4) Close the web browser
5) Repeat once a day
So far this is the code I have
Code:
#! /bin/bash
a=( $(shuf -n1 /usr/share/dict/american-english) )
for i in ${a}
do
xdg-open https://www.bing.com/search?q=$i
done
exit 0
So I cannot make it repeat a specific number of times, of course I can just put the same code multiple times but Im trying to do it right.
Also when the web browser is already open it gives the error
Code:
[7259:7294:0731/114659.197592:ERROR:browser_gpu_channel_host_factory.cc(103)] Failed to launch GPU process.
Created new window in existing browser session.
Which is fine because it just opens another browser but I wonder if I can make it do the search in the same tab/page.
Lastly, I cannot figure out how to make it close the browser when it has finished its task. The uuid is different each time it loads.
Thanks for any help!