<div dir="ltr"><div><div>or<br></div>if ping -c1 hostname ; then false; else true; fi<br><br></div>You may or may not want to redirect the output of ping to /dev/null<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 23, 2014 at 8:34 AM, Nathan Dorfman <span dir="ltr"><<a href="mailto:na@rtfm.net" target="_blank">na@rtfm.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Sep 22, 2014 at 2:04 PM, Chris Green <<a href="mailto:cl@isbd.net">cl@isbd.net</a>> wrote:<br>
> However this doesn't work of course. Is there any easy way (i.e. an<br>
> executable command) which will logically not the value that ping<br>
> returns? I know I could write a little script that does the job but<br>
> if can do it without I'd be happier.<br>
<br>
<br>
</span>There's probably a nicer way to do it, but this should work:<br>
<br>
ping -c1 hostname; test "$?" -ne 0<br>
<span class="HOEnZb"><font color="#888888"><br>
-nd.<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> --<br>
> Chris Green<br>
<br>
--<br>
ubuntu-users mailing list<br>
<a href="mailto:ubuntu-users@lists.ubuntu.com">ubuntu-users@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Kevin O'Gorman<br><br>programmer, n. an organism that transmutes caffeine into software.<br><span style="line-height:normal;font-variant:normal;font-size:10pt;font-style:normal;font-weight:normal"><span style="line-height:normal;font-variant:normal;font-size:10pt;font-style:normal;font-weight:normal"></span></span><table border="0" cellpadding="0" cellspacing="0" width="448"><tbody><tr><td width="25"><img src="cid:XVHDKDFDBURW.IMAGE_60.gif" height="21" width="25"></td>
<td width="423"><span style="FONT-FAMILY:Verdana,Geneva,sans-serif;COLOR:rgb(0,153,0);MARGIN-LEFT:5px;FONT-SIZE:10px">Please consider the environment before printing this email.</span></td></tr></tbody></table><br></div>
</div>