I have a list of URLs to be downloaded through wget. For a single file when I enter following command in shell it downloads and saves file correctly.

wget -O IPSL-CM5A-LR-tasmin-Historical-19500101-19501231.nc https://dataserver.nccs.nasa.gov/thredds/ncss/bypass/NEX-GDDP/bcsd/historical/r1i1p1/tasmin/IPSL-CM5A-LR.ncml?var=tasmin&north=55&west=72&east=136&south=16&horizStride=1&time_start=1950-01-01T12%3A00%3A00Z&time_end=1950-12-31T12%3A00%3A00Z&timeStride=1

However when I put use it in the following script for a list of URLs I get following error.

while read -r line; do wget -O $line; done < one_model.txt

Connecting to dataserver.nccs.nasa.gov (dataserver.nccs.nasa.gov)||:443... connected. HTTP request sent, awaiting response... 400 Bad Request 2020-01-07 10:30:47 ERROR 400: Bad Request.

  • You need to provide some more details. Can you pass the --debug flag to Wget so we can see exactly what the server replied back with?
    – darnir
    Commented Jan 15, 2020 at 16:12

1 Answer 1


The line in your script should work in a somewhat untidy way. Check that there are two fields in your file of URLs, first the output file and then the URL with a space separating the two.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .