<div dir="ltr">Suppose /usr/bin/zonename returned "-f", producing:<div><br></div><div style>[ -f = global ]</div><div style><br></div><div style>which would fail because "=" likely isn't a filename, a test for the existence of a file by that name likely isn't anywhere close to what you want to do, and "global" would be an unrecognized argument.</div><div style><br></div><div style>Richard's approach is a good one in the general case, even if in this case it's very unlikely to have any practical effect.  I use Richard's approach myself.  You should, too.  :)</div></div><div class="gmail_extra"><br clear="all"><div><div><br></div>-- <div><b>Steve Coile<br></b>Senior Network and Systems Engineer, <a href="http://www.mcclatchyinteractive.com/" target="_blank">McClatchy Interactive</a><div><font size="1">Office: 919-861-1247 | Mobile: 919-622-5369 | Fax: 919-861-1300</font></div></div></div>
<br><div class="gmail_quote">On Fri, Oct 3, 2014 at 2:31 AM, Jeremy Laidman <span dir="ltr"><<a href="mailto:jlaidman@rebel-it.com.au" target="_blank">jlaidman@rebel-it.com.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 2 October 2014 02:46, Richard L. Hamilton <span dir="ltr"><<a href="mailto:rlhamil2@gmail.com" target="_blank">rlhamil2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="overflow:hidden">if [ -x /usr/bin/zonename ] && [ x”`/usr/bin/zonename`” = x”global” ]<br>
</div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="overflow:hidden">(the x in front of the strings being compared is just paranoia against one of them having a syntactically confusing value, like a dash option or an = sign)</div></blockquote></div><br>I could be wrong, but I don't know of any shell that would misinterpret a dash or equals when inside double quotes.</div><span class="HOEnZb"><font color="#888888"><div class="gmail_extra"><br></div><div class="gmail_extra">J</div><div class="gmail_extra"><br></div></font></span></div>
<br>_______________________________________________<br>
Xymon mailing list<br>
<a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a><br>
<a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
<br></blockquote></div><br></div>