Guido Günther <[EMAIL PROTECTED]> writes:

> On Tue, Feb 26, 2008 at 05:03:04PM +0100, Frans Pop wrote:
>> This line is way to cryptic to my taste:
>>         [ -n "$(/sbin/multipath -l)" && $? ] && return 0 || return 1
>> 
>> Could you rewrite that to something that is a bit more intuitive?
>
> This one is simpler and much more robust against weird multipath -l
> output. O.k. to apply?
>  -- Guido
>
> diff --git a/packages/hw-detect/disk-detect.sh 
> b/packages/hw-detect/disk-detect.sh
> index efe55b0..3290832 100755
> --- a/packages/hw-detect/disk-detect.sh
> +++ b/packages/hw-detect/disk-detect.sh
> @@ -102,7 +102,12 @@ defaults {
>  EOF
>       fi
>       log-output -t disk-detect /sbin/multipath -v$MP_VERBOSE
> -     [ -n "$(/sbin/multipath -l)" && $? ] && return 0 || return 1
> +
> +     if multipath -l 2>/dev/null | grep -q '^mpath[0-9]\+ '; then
> +             return 0
> +     else
> +             return 1
> +     fi
>  }

Much much better! :-)

But why you've change to grep instead checking the $?

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: [EMAIL PROTECTED]      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."


Reply via email to