Forum Moderators: bakedjake
i have a simple script which runs wget to mirror a complete website
#!/bin/sh
wget -N options savepath url
this works fine.
i'd like to refine it to read a list of URLs from a file:
while read f
do
echo "url = $f"
`wget -N -P$SAVE_PATH $LOGIN $f`
done < $file
the script reads the file correctly and echoes out a list of URLs, but if i enclose wget in backquotes i get GNU: command not found. but if i leave the quotes off, then i get the standard blurb about wget echoed to my screen.
obv. no file is mirrored ;-)
how do i invoke wget in this instance?
many thanks!
<added> found it - it was all in the syntax. it needs backquotes and correct order of wget syntax:
`wget -N $LOGIN -P $SAVE_PATH $f`
thanks anyway :-)
yeah i just found that out myself too ;-)
although the only way i could get the URLs from a file into the one var was:
while read f
do
var="$var $f"
done < $f
`wget -N $LOGIN -P $SAVE_PATH -I $var`
it works by concatting each line $f to the $var, separated by a space. i come from php so was searching in vain for $var .= $f but couldn't find it. is there such a thing in a shell script?
cheers