Sponsored Content
Homework and Emergencies Homework & Coursework Questions Loop Script with wget until exit is typed Post 303038757 by Jgerds1990 on Thursday 12th of September 2019 11:51:51 PM
Old 09-13-2019
Loop Script with wget until exit is typed

Morning all,

I am attempting to complete the below script which will do the following (skip the ping part) using Bash.

Prompts the user to type in a URL to download, or to type exit to exit the script.
If a URL is typed, wget to download the webpage and then loop back to prompting for a typed URL or to type exit.
Basically the script continually loops back to prompting for a webpage after the wget is complete of the previous webpage until the user types exit into the prompt



This is what I have now but I'll explain below other things I've tried
Image

I'm not asking for the answer (of course) just a push towards what I should be thinking about. As you can see, I currently have break at line 17 because, of course, without it, it currently will just continue to wget the URL as it gets stuck in an infinite loop. I am sure the solution is simple but I honestly can not wrap my head around how to get it to complete 1 wget and then go back to the url prompt repeatedly until the user types exit.


ECU, WA Australia, CSI6203 Scripting Languages.
This User Gave Thanks to Jgerds1990 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

while loop exit

i wrote a while script as part of a huge program. this script, once picked, begins to output data to the person using it. pretty easy, as the person doesn't have to keep typing commands to get the output that the while loop automatically throws out. now, the thing is, while this while-script... (3 Replies)
Discussion started by: Terrible
3 Replies

2. Shell Programming and Scripting

wget in a loop

I have not done any scrpting before and also new to unix. Thanks. I am using wget to download contents as below: wget http://server/app/browse/downloadRaw?id=23456I want to do this programatically. For example, I have a list of id in a text file as below: list.txt ---------- 23456... (1 Reply)
Discussion started by: Lilly
1 Replies

3. Shell Programming and Scripting

Exit for loop in a shell script if a condition is successfull

Hi All, I am stuch in a script where a for loop is running to execute some commands for some values. Now my problem is i have to have an if condition that if the first iteration is successful then it has to exit the for loop otherwise it has to continue normally. my code is this: for... (5 Replies)
Discussion started by: usha rao
5 Replies

4. Shell Programming and Scripting

Wget exit code for each line in file

I am trying to validate links inside file if its up or not. Heres what I am trying : #!/bin/bash link='cat url' get=$(wget -q "$link") if then echo "Link not up" else echo "OK" fi $ ./validate ./validate: line 4: Please suggest .. Thanks, (2 Replies)
Discussion started by: sriram003
2 Replies

5. Shell Programming and Scripting

Bash script to accept password and replace characters with * as they are typed

I googled this and couldn't find an answer, so I rolled my own. Here it is, hope it helps. Feel free to improve on it. #!/bin/bash PWORD= ANYKEY=0 echo -n "Password: " until do read -N 1 -s ANYKEY echo -n "*" PWORD="$PWORD$ANYKEY" done echo echo $PWORD exit (3 Replies)
Discussion started by: krisdames
3 Replies

6. Emergency UNIX and Linux Support

For loop exit

Below for loop not exiting. Can someone help? JBOSS_INST_ARGS=01 02 if ; then for i in $JBOSS_INST_ARGS; do /u/jboss-6.1.0.Final/bin/jboss_init_wise$i.sh start; done (8 Replies)
Discussion started by: vino_hymi
8 Replies

7. Shell Programming and Scripting

bash script using scp (pw typed by hand) followed by removal of files

Hello, I tried to write a bash script (code is below) that does scp files that contain a certain string, and that subsequently deletes only those files that have been copied (in my case new files are created every second so it is important to only delete those that have been copied). The key is... (0 Replies)
Discussion started by: kjartan
0 Replies

8. Shell Programming and Scripting

Bash Question: HowTo Exit Script with User Input While Process is Running Mid-Loop?

Hi, I have written a script that allows me to repetitively play a music file $N times, which is specified through user input. However, if I want to exit the script before it has finished looping $N times, if I use CTRL+c, I have to CTRL+c however many times are left in order to complete the loop.... (9 Replies)
Discussion started by: hilltop_yodeler
9 Replies

9. Shell Programming and Scripting

Exit while loop on execute script

Hi, I have first script which on IR remote command event execute the second script. If the second script is executed, it display echo "timeout expired" after 10s. This works as expected. But I also want to reset timer (increase time) in case if the second script is executed again within 10s. ... (8 Replies)
Discussion started by: armatron
8 Replies

10. Shell Programming and Scripting

While loop is causing ssh command to exit from script after first iteration.

I am trying to check multiple server's "uptime" in a loop over "ssh". When I execute multiple ssh commands with hard coded servernames script is executing fine. But when I pass server names using while loop, script is exiting after checking first server's status, why? # serverList... (8 Replies)
Discussion started by: kchinnam
8 Replies
WMGRABIMGAE(1)						      General Commands Manual						    WMGRABIMGAE(1)

NAME
WMGRABIMGAE - Dockable WWW Image monitor. SYNOPSIS
wmGrabImage [-h] [-display <Display>] -url <Image URL> [-http <URL>] [-c] [-delay <Time>] DESCRIPTION
wmGrabImage is a WindowMaker DockApp that maintains a small thumbnail copy of your favorite image from the WWW. The image to monitor is specified via the "-url <Image URL>" command-line option and it gets updated approximately every 5 minutes. The update interval can be overridden via the "-delay <Time>" command-line option (Time is in seconds). Each of the three mouse buttons can be double clicked with the following effects; Left Mouse: Brings up the full-sized image in xv. Middle Mouse: Sends a URL (specified via the -http <URL> command-line option) to an already running netscape process or in a new netscape process if there arent any running. Right Mouse: Updates the image immediately. OPTIONS
-h Display list of command-line options. -display [display] Use an alternate X Display. -url <Image URL> The URL of the WWW image to monitor. -http <URL> The URL to send to netscape via a Middle double click. -c Center the image vertically within the icon. -delay <Time> The time between updates. The default is about 5 minutes. FILES
The original sized image and the thumbnail XPM image are both stored in ~/.wmGrabImage/ which gets created if it doesnt already exist. SEE ALSO
wget and the ImageMagick convert utility. BUGS
Who knows? -- its still Beta though. (Let me know if you find any). Oldish versions of the ImageMagick convert utility have a memory leak -- if you have that problem, upgrade to the latest version. AUTHOR
Michael G. Henderson <mghenderson@lanl.gov> 16 December 1998 WMGRABIMGAE(1)
All times are GMT -4. The time now is 10:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy