Get Boolean from ping

Get Boolean from ping

Post by Gnarlodiou » Thu, 17 Feb 2005 01:38:17



Is there an easy way to get a binary result from the ping command? I want a
zero or a one.

--
Cosmetic Justice; when the Botox gives you Mad Cow Disease
                                            -- Gnarlodious

 
 
 

Get Boolean from ping

Post by Chris F.A. Johnso » Thu, 17 Feb 2005 01:51:22



> Is there an easy way to get a binary result from the ping command? I want a
> zero or a one.

ping <args> >/dev/null && echo 0 || echo 1

    (Or do you want something else?)

--
    Chris F.A. Johnson                  http://cfaj.freeshell.org/shell
    ===================================================================
    My code (if any) in this post is copyright 2005, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License

 
 
 

Get Boolean from ping

Post by Gnarlodiou » Thu, 17 Feb 2005 03:24:52


Entity Chris F.A. Johnson spoke thus:


>> Is there an easy way to get a binary result from the ping command? I want a
>> zero or a one.

> ping <args> >/dev/null && echo 0 || echo 1

>     (Or do you want something else?)

Nope, that'll do, thanks!

-- Gnarlie
When you scratch a cynic you find a disappointed idealist underneath
                                                               George Carlin

 
 
 

1. A pings B, B pings C, C cannot ping A

In our small network, we have several w9x clients, a w2k server and a
linux server. To date, integration of these has been going ok. However,
today, we brought up some clients that cannot ping to the linux server
(all of this by IP address), but they can ping to the w2k server, which
are physically next to each other, and connect to the same switch. There
have been no problems with communication between the linux system, w2k
system and other computers on site. The clients use dhcp on the w2k
server to get their ip addresses. The only issues that I can think of at
this time is that the problem systems are on the longest runs from the
hub, which appear to be a little over the 100m line, and the linux and
w2k units (probably) have different nics. Can anybody out there shed
some light on this situation?

Thanks,

Sent via Deja.com
http://www.deja.com/

2. Can smail handle multiple domains?

3. Pinging and getting NOPS

4. help with redhat 6.2 and upgrades

5. ping - getting crazy

6. Uploading files with apache?

7. SCO 5.0.4 Gets "SLOW" response to pings

8. FTP problems

9. Ping replies getting reordered ...

10. Ever backgrounded a ping or gotten fping to work???

11. Getting ping to run a file

12. Ping time gets longer and longer

13. PPP gets DHCP IP but can't ping gateway