[ClusterLabs] Antw: Re: Antw: Re: Q: ocf:pacemaker:NodeUtilization monitor

Andrei Borzenkov arvidjaar at gmail.com
Mon Jun 3 02:39:51 EDT 2019


03.06.2019 9:09, Ulrich Windl пишет:
>>>>
>>>>> 118     if [ ‑x $xentool ]; then
>>>>> 119         $xentool info | awk
>>> '/total_memory/{printf("%d\n",$3);exit(0)}'
>>>>> 120     else
>>>>> 121         ocf_log warn "Can only set hv_memory for Xen hypervisor"
>>>>> 122         echo "0"
>>>>
>>>> So kind of a mystery :‑)
>>>
>>> Except when $xentool is undefined ;-)
>>
>> How can condition [ -x $xentool ] be true then? Unless there actually is
> 
> Easy actually: Try " [ -x ] && echo 1": To my surprise it did not give a
> syntax error (The correct usage would be '[ -x "" ] && echo 1' anyway.
> 

Apparently test command interprets this as test for non-empty string.
I.e. "-x" is interpreted as unary operator only if it is followed by
some additional argument.


More information about the Users mailing list