bug in arithmetic expansion

2019-11-09 Thread Joern Knoll
Hallo, in playing around with digital keys (integers) which have a simple arithmetic check property, I encountered problemsusing bash's arithmetic expansion, when ever the used digital substrings have leading zeros. The problem shows up already for the simplest operations, namely converting

Re: quote removal issues within character class

2019-11-09 Thread Oğuz
You've already answered it, thank you. I didn't know that [:, [., [= were special *sequences*, I guess I overlooked that part. Thanks again for taking time to explain it in detail, I'm grateful 9 Kasım 2019 Cumartesi tarihinde Robert Elz yazdı: > Date:Sat, 9 Nov 2019 07:35:16 +0300

Re: bug in arithmetic expansion

2019-11-09 Thread pepa65
In the arithmetic context, leading zeroes signify an octal base. Had you used an 8 or 9, you would have gotten a message like: bash: 08: value too great for base (error token is "08") when trying: echo $((08)) So it's not a bug, it's a feature; make sure your base-10 numbers don't have leading

Re: quote removal issues within character class

2019-11-09 Thread L A Walsh
FWIW, Andreas's description really was sufficient...

Re: bug in arithmetic expansion

2019-11-09 Thread Robert Elz
Date:Sat, 9 Nov 2019 16:39:52 +0100 From:Davide Brini Message-ID: <1mi5ud-1ifip305pl-00f...@mail.gmx.com> | If you want to force base 10 interpretation (remember that leading 0 mean | octal in arithmetic context), you need to explicitly tell bash: | | $ echo

Re: quote removal issues within character class

2019-11-09 Thread Robert Elz
Date:Sat, 9 Nov 2019 07:35:16 +0300 From:=?UTF-8?B?T8SfdXo=?= Message-ID: | is correct, as "foo" does not contain a ']' which would be required | > to match there (quoting the ':' means there is no character class, | > hence we have instead (the negation of)

Re: quote removal issues within character class

2019-11-09 Thread Robert Elz
Date:Sat, 09 Nov 2019 06:46:05 -0800 From:L A Walsh Message-ID: <5dc6d12d.6040...@tlinx.org> | Is this really what the standard says, Yes, I used cut (and then some line length/wrappoing reformatting) | because '\\' is not a character, but 2 characters. In sh,

Re: bug in arithmetic expansion

2019-11-09 Thread Davide Brini
On Sat, 9 Nov 2019 11:52:56 +0100, Joern Knoll wrote: > [tplx99]:/the/knoll > echo $((0123)) > 83 > [tplx99]:/the/knoll > echo $((123)) > 123 > [tplx99]:/the/knoll > echo $((01234)) > 668 > [tplx99]:/the/knoll > echo $((1234)) > 1234 If you want to force base 10 interpretation (remember that

Re: quote removal issues within character class

2019-11-09 Thread L A Walsh
On 2019/11/09 04:49, Robert Elz wrote: > There's also > > The special characters '.', '*', '[', and '\\' > (, , , and , > respectively) shall lose their special meaning within a bracket > expression. > Is this really what the standard says, because '\\' is not a

Re: quote removal issues within character class

2019-11-09 Thread Andreas Schwab
On Nov 09 2019, L A Walsh wrote: > On 2019/11/09 04:49, Robert Elz wrote: >> There's also >> >> The special characters '.', '*', '[', and '\\' >> (, , , and , >> respectively) shall lose their special meaning within a bracket >> expression. >> > > Is this really what