LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 07-31-2017, 01:57 PM   #1
Wi1done
LQ Newbie
 
Registered: Jul 2017
Posts: 6

Rep: Reputation: Disabled
Help with first script


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!
 
Old 08-02-2017, 08:36 AM   #2
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
1 members found this post helpful.
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script/Perl Script to remove the string until it finds special character '_' pooppp Programming 1 07-13-2012 01:03 AM
Shell script, Perl script, command or utility to convert Binary to text Perseus Programming 26 07-12-2012 06:00 AM
[SOLVED] bash and xterm: how make apps started by and for a script persist when script terminates porphyry5 Linux - General 4 06-15-2011 01:27 PM
[SOLVED] Script question: create a shell script in kde to log in on a server with ssh c4719929 Linux - Newbie 1 01-31-2011 03:05 AM
How to get full path to script file inside script itself? And in case of sym links? maggus Linux - Newbie 3 05-28-2009 08:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration