On 04/29/16 at 03:36pm, Pratyush Anand wrote:
On Fri, Apr 29, 2016 at 3:17 PM, Xunlei Pang <xpang(a)redhat.com>
wrote:
> On 2016/04/29 at 17:29, Pratyush Anand wrote:
>> Hi Xunlei,
>>
>> On Fri, Apr 29, 2016 at 2:15 PM, Xunlei Pang <xpang(a)redhat.com> wrote:
>>> Besides, I would recommend "return 0" for successful cases,
>>> and "return 1" for failed cases, it's semantically better.
>> I think all the function which starts with is_ has same semantic what
>> has been used in this patch. For example, when
>> is_dump_target_configured() returns 1, it means dump target has been
>> used in kdump.conf. Moreover, it seems reasonable to return true(1)
>> when answer of question is_xxxxxxx is "yes".
>
> Yes, I understood that way at the beginning, but in shell world, seems
> return 0 is true.
>
> is_dump_target_configured() actually returns 0 for true cases(target found):
> [ -n "$_target" ]
>
> if $_target is NULL, $? is 1, otherwise $? is 0(true).
>
$_target is NULL or non-empty? I think, -n represent non-empty.
I am also a beginner for shell, so others can confirm.
I think xunlei means non-empty, you have same understanding :)
Just the return code difference, in bash return 0 should be true
otherwise it is false.
Thanks
Dave