On Wed, 28 Oct 2009 17:41:05 PDT
Sherry Yu <sherry.yu at sun.com> wrote:

> I need to have a command return exit code 0 if a zpool is already imported. 
> Currently 
> 'zpool import <zpool_name>' would return exit code 1, error, if <zpool_name> 
> is already imported. Any other way to bypass this issue? Thanks!

I saw the post about zpool list maybe doing the right thing, but if it
doesn't wrapping zpool in a trivial script should solve the problem:

        #!/bin/sh
        zpool import <zpool_name>
        exit $((1-$?))

Untested. I'm not sure if OpenSolaris /bin/sh support $(( )), but
that's the idea.

          <mike
-- 
Mike Meyer <mwm at mired.org>           http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Reply via email to