2017-08-11 13:14 GMT+02:00 Alessandro DE LAURENZIS <jus...@atlantide.t28.net
> Hi Janne,
> On Fri 11/08/2017 13:07, Janne Johansson wrote:
>> 0<number> is parsed as octal in places, so 09 would be bogus if octal.
> Thanks for the clarification; does that mean expr(1) can treat 10-base
> numbers only? No info in man page on this matter...
Well, I think the default would be for simple math stuff to only use base
Then stuff like $(()) should perhaps say it accepts hex,octal or whatever
outside of that.
$ echo $(( 09 + 1))
ksh: 09 + 1: bad number `09'
$ echo $(( 08 + 1))
ksh: 08 + 1: bad number `08'
$ echo $(( 07 + 1))
I have used the "skip leading zeros" at times with expr in order to handle
possibly empty environment vars with stuff like:
sleep $(expr 0$MIGHT_HAVE_VALUE + 1) so that an unset env-var will not make
expr treat it like $(expr + 1) which would
be an error.
May the most significant bit of your life be positive.