LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Scripting: How to put wget in foreground? (http://www.linuxquestions.org/questions/linux-software-2/scripting-how-to-put-wget-in-foreground-697074/)

klss 01-13-2009 02:46 PM

Scripting: How to put wget in foreground?
 
Hi there.

I am using wget in a script for downloading stuff from sourceforge (http).

It seems to start in background, so that the script continues.
This makes the script fail.

How do I get wget in the forground? Or is there another solution to it.
Somehow downloads from ftp server do work.


THX

acid_kewpie 01-13-2009 02:58 PM

nothing will fork unless you tell it to... maybe if you actually showed us your script you'd be able to get more help... with urls from sf.net and such, are there maybe some &'s in the url that you're not handling properly?

eco 01-13-2009 03:00 PM

Hi,

Try using the command wait. It should do the job.

I found the following link for an example on how to use it: link

klss 01-13-2009 03:36 PM

Hi.

This is the function I use in the script.

Code:

download () {
header "Download data"
cd $SOXSRCDIR
wget -nd -v http://downloads.sourceforge.net/sox/sox-14.2.0.tar.gz?modtime=1226179484&big_mirror=0  >>$LOG
tar -xvvf $SOXPACK >>$LOG
}

I also introduced background = off in /etc/wgetrc - NO change.


I'll checkout the "wait" hint. Even though I don't understand, why it is
not working.

THX so far.

Cheers

klss 01-13-2009 03:50 PM

"wait" did the trick.

THX a lot. :D

acid_kewpie 01-13-2009 03:52 PM

well wait isn't the right way to solve this at all... As i guessed, the & in the url is causing a fork, so everything after that is being treated as a new command, which will fail and give an error before moving on. if the url works with the & and everything past it removed, then remove it.

eco 01-13-2009 04:35 PM

... or put a single quote on either side of the URL.

klss 01-13-2009 04:53 PM

THX a lot folks. A real beginner problem.

When I look at it now - it seems to be more than obvious. ;)

Cheers


All times are GMT -5. The time now is 10:47 AM.