Xymon Mailing List Archive search

Solaris 11 Zones iostat problem

list Steve Coile
Fri, 3 Oct 2014 08:45:04 -0400
Message-Id: <CAHr=user-4b7c1a66c715@xymon.invalid>

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