Suppose /usr/bin/zonename returned "-f", producing:
[ -f = global ]
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.
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. :)
--
*Steve Coile*Senior Network and Systems Engineer, McClatchy Interactive
<http://www.mcclatchyinteractive.com/>
Office: XXX-XXX-XXXX | Mobile: XXX-XXX-XXXX | Fax: XXX-XXX-XXXX
On Fri, Oct 3, 2014 at 2:31 AM, Jeremy Laidman <user-71895fb2e44c@xymon.invalid>
wrote:
On 2 October 2014 02:46, Richard L. Hamilton <user-af55987f6d56@xymon.invalid> wrote:
if [ -x /usr/bin/zonename ] && [ x”`/usr/bin/zonename`” = x”global” ]
(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)
I could be wrong, but I don't know of any shell that would misinterpret a
dash or equals when inside double quotes.
J