0

I'm trying to download data from the following link

export ICTP_DATASITE='http://clima-dods.ictp.it/data/Data/RegCM_Data/EIN15/1990/'

These are the codes :

for type in "air hgt rhum uwnd vwnd"
do
    for hh in "00 06 12 18"
    do
       curl -o ${type}.1990.${hh}.nc \
       ${ICTP_DATASITE}/EIN15/1990/${type}.1990.${hh}.nc
    done
done

But its not downloading and im getting the following error message

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: hgt
curl: (6) Could not resolve host: rhum
curl: (6) Could not resolve host: uwnd
curl: (6) Could not resolve host: vwnd.1990.00
curl: (7) Could not resolve host: vwnd.1990.00
curl: (7) Could not resolve host: vwnd.1990.00
curl: (6) Could not resolve host: 18.nc
curl: (3) <url> malformed
curl: (6) Could not resolve host: hgt
curl: (6) Could not resolve host: rhum
curl: (6) Could not resolve host: uwnd
curl: (6) Could not resolve host: vwnd.1990.00
curl: (7) Could not resolve host: vwnd.1990.00
curl: (7) Could not resolve host: vwnd.1990.00
curl: (6) Could not resolve host: 18.nc

Can you please help me.

  • is ipv6 enabled ? what you get if you do nslookup the domain ? – Rahul Jun 21 '16 at 4:59
2

Remove the double-quotes from the loop items in the for lines - you're iterating over single strings ("air hgt rhum uwnd vwnd" and "00 06 12 18"), not lists of items.

Also, type is a reserved word in bash. Use another variable name, e.g. t, instead.

Finally, you should always double-quote your variables when you use them.

Putting that all together, try this:

export ICTP_DATASITE='http://clima-dods.ictp.it/data/Data/RegCM_Data/EIN15/1990/'

for t in air hgt rhum uwnd vwnd; do
    for hh in 00 06 12 18; do
       curl -o "${t}.1990.${hh}.nc" \
       "${ICTP_DATASITE}/EIN15/1990/${t}.1990.${hh}.nc"
    done
done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.