|
From: | Pascal Hambourg |
Subject: | Re: Negation in a condition triggers error message |
Date: | Fri, 16 Jun 2023 08:33:50 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 |
On 16/06/2023 at 02:21, Adam Vodopjan wrote:
I'm on grub 2.06 in ubuntu 22.04 grub> [ a -gt 9 ]; echo $? 1 grub> [ ! a -gt 9 ]; echo $? error: unrecognized number. 0 grub> [ a -lt 9 ]; echo $? error: unrecognized number. 0 grub> [ ! a -lt 9 ]; echo $? 1 grub> [ a -eq 9 ]; echo $? 1 grub> [ ! a -eq 9 ]; echo $? error: unrecognized number. 0 Why does it show/hide the error depending on the negation? Evidently, the error should be shown each time, one of the args is not a number in each example.
It looks like the error is shown only when the whole condition is true, assuming that the non-number argument is evaluated as 0.
[Prev in Thread] | Current Thread | [Next in Thread] |