-   Linux - Software (
-   -   Scripting: How to put wget in foreground? (

klss 01-13-2009 03: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.


acid_kewpie 01-13-2009 03: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 and such, are there maybe some &'s in the url that you're not handling properly?

eco 01-13-2009 04:00 PM


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 04:36 PM


This is the function I use in the script.


download () {
header "Download data"
wget -nd -v  >>$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.


klss 01-13-2009 04:50 PM

"wait" did the trick.

THX a lot. :D

acid_kewpie 01-13-2009 04: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 05:35 PM

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

klss 01-13-2009 05:53 PM

THX a lot folks. A real beginner problem.

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


All times are GMT -5. The time now is 02:57 AM.