Download raw body.
regress common.sh: POSIX arithmetic for trim_obj_id()
On Wed, Sep 16, 2020 at 07:37:01PM +0200, Christian Weisgerber wrote:
> This one had me puzzled. How did the while condition ever work?
> Apparently, variables are expanded without '$' for arithmetic(!)
> comparisons inside [[ ... ]] and in our (k)sh this behavior accidentally
> leaks out to [ ... ].
From ksh(1):
Arithmetic expressions
Integer arithmetic expressions can be used with the let command, inside
$((..)) expressions, inside array references (e.g. name[expr]), as
numeric arguments to the test command, and as the value of an assignment
to an integer parameter.
`test' is `[', so that is known^Wdocumented behaviour.
> Mark the variables as "local" while here. Actually, "local" isn't
> part of the POSIX shell language, but it's used pervasively in these
> scripts and seems widely supported in practice.
OK kn
regress common.sh: POSIX arithmetic for trim_obj_id()