tags:

views:

182

answers:

4

Code:

for i in {0..3}; do ping http://www.pythonchallenge.com/pc/def/$i.html; done

A host should be found at www.pythonchallenge.com/pc/def/0.html.

I get this error for all pings:

ping: cannot resolve www.pythonchallenge.com/pc/def/0.html: Unknown host

+5  A: 

html pages != hosts. If you want to check if the three web pages actually exist, use wget. If you only want to check if the host is up, ping www.pythonchallenge.com.

wds
+2  A: 

You can't ping an address, you can only ping the domain aka www.pythonchallenge.com

If your trying to find the pages that actually contain content, you will need to use something like wget and combine that with grep to check the content.

Mark Davidson
+2  A: 

You're confusing protocols here. HTTP has nothing to do with ICMP pings.

That said, you can ping www.pythonchallenge.com because it resolves to an IP. On the other hand, there's no DNS resolution for www.pythonchallenge.com/pc/def/0.html simply because that's an URL, not a host. Browsers first resolve www.pythonchallenge.com via DNS, then they make a HTTP request for the page itself.

I'm not sure what you're trying to accomplish here. You may want to simply ping www.pythonchallenge.com.

Eduard - Gabriel Munteanu
A: 

I think you're going about this problem the wrong way. Have you tried http://www.pythonchallenge.com/pc/def/1.html? Have you tried Googling that number?

(Assuming that your URL isn't just an example, of course.)

Mark