Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > PING exit problem

PING exit problem
Thread Tools
BostonMACOSX
Forum Regular
Join Date: Nov 2000
Location: Boston Area,ma
Status: Offline
Reply With Quote
Jul 29, 2004, 09:35 PM
 
I'm trying to write a shell script with ping.
trouble is is that ping on OS X returns 0 with successful xmit and receive and also 0 with successful xmit and no receive and only returns 1 when the host can't be found. This is not how ping is suppose to work. The only way that ping should return 0 is on a complete success.

What gives? Is this an OS X error.

Thanks
Robert
OSX ...Plastic surgery for unix
Boston Area Consulting
http://rjhcc.dyndns.biz
http://bostonmacosx.dyndns.org
     
suthercd
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Jul 29, 2004, 10:37 PM
 
Robert,
This performs as advertised on my machine:
Code:
#!/bin/sh # pingreturnvalue.sh HOST=some.address.here.com if ping -c 1 $HOST &> /dev/null ; then echo "Successful ping to $HOST" else echo "Ping failed to $HOST" fi
HTH
Craig
     
BostonMACOSX  (op)
Forum Regular
Join Date: Nov 2000
Location: Boston Area,ma
Status: Offline
Reply With Quote
Jul 29, 2004, 10:42 PM
 
Originally posted by suthercd:
Robert,
This performs as advertised on my machine:
Code:
#!/bin/sh # pingreturnvalue.sh HOST=some.address.here.com if ping -c 1 $HOST &> /dev/null ; then echo "Successful ping to $HOST" else echo "Ping failed to $HOST" fi
HTH
Craig
I've tried that.....it successes on machine where you can send a packet but isn't returnable.
That is the error I'm finding with ping.

So lets say I ping tony.tony.tony no DNS machine off I get ping failed.
I ping ***.***.*** where the macine exists but is behind a firewall I get a success.
I ping 192.168.X.X on my local network I get a success.

It is the middle condition which should be a failure.

OS X 10.3.4.
OSX ...Plastic surgery for unix
Boston Area Consulting
http://rjhcc.dyndns.biz
http://bostonmacosx.dyndns.org
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:37 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,