Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've had working script, which suddenly doesn't works. It contains something like this:

while read url;
    curl $url
done < links

links file:

And I get couldn't resolve hostname error.

curl: (6) Could not resolve host:
curl: (6) Could not resolve host:

But, when the loop is removed, it works so it's not a network problem.

curl $url

I've been looking into this whole day and I believe it is some stupidity but I wasn't able to figure it out. (quotes tried)

share|improve this question
Your script works fine for me. Is there something else about the environment you're running under that might be missing? – Joel Taylor Sep 11 '13 at 17:19
I've no clue. Using Arch, recently did upgrade (pacman -Syyu) – Lukasik Sep 12 '13 at 6:29
Have you edited your links file since the last time this worked? Is there any chance that you got invisible characters (like carriage returns) in there? Try read url < links; curl $url (should do the first line only). – Scott Sep 12 '13 at 21:55
Yes, it is output from another script. Your example doen't works. I tried it in fresh install of xubuntu in virtual and got the same result. – Lukasik Sep 13 '13 at 9:37
The issue must be with your links file. I tried Scott's example and didn't have any issue when using my own, hand-crafted links file. Have your tried your script with a custom links file? – Joel Taylor Sep 13 '13 at 21:24

You must log in to answer this question.

Browse other questions tagged .