On 2023-10-30 08:09, Chet Ramey wrote:
The fact that this whitespace issue hasn't been reported since then shows
how obscure it is.
Yes, I noticed it only because coreutils 'test' was incompatible with
Bash. (It was also incompatible with everybody else!)
I recently changed bleeding-edge
On 10/29/23 6:18 AM, Oğuz wrote:
legal_number was isint, which skipped both leading and trailing space
using the whitespace macro.
Yes, 30 years ago. legal_number switched to using strtol(3) in 1997
(bash-2.02) and strtoimax in 2002 (bash-2.05b).
The fact that this whitespace issue hasn't
On 10/28/23 3:08 PM, Paul Eggert wrote:
The problem occurs because strtoimax accepts all forms of leading
whitespace, whereas Bash accepts only space and tab after the integer. This
is inconsistent: Bash should treat trailing whitespace the same way it
treats leading whitespace, and should
On 10/29/23 3:43 AM, Martin D Kealey wrote:
I'm more concerned that the error message is misleading; "integer
expression expected" is NOT true; rather an integer LITERAL is expected
(meaning an optional sign followed by one or more digits).
This got changed about a year ago, after
On 2023-10-29 03:18, Oğuz wrote:
I think the intented behavior was skipping both leading and trailing
horizontal whitespace, which makes sense as a QOL feature, and switching
over to strtoimax changed this.
If that's the intent, which is self-consistent but which disagrees with
all other
On Sun, Oct 29, 2023 at 8:49 AM Paul Eggert wrote:
> My understanding is that Bash was intended to allow both leading and
> trailing whitespace. This is compatible with ksh and with Dash. If
> that's the intent, Bash should be consistent about it, just as ksh and
> Dash are. There seems little
I'm more concerned that the error message is misleading; "integer
expression expected" is NOT true; rather an integer LITERAL is expected
(meaning an optional sign followed by one or more digits).
As for fixing the inconsistency, I would rather get rid of whitespace
skipping entirely, perhaps
Date:Sat, 28 Oct 2023 22:49:13 -0700
From:Paul Eggert
Message-ID:
| I don't know what bosh is.
bosh is a modernised (updated) variant of the SysVR4 Bourne shell
I believe - it used to be maintained by Joerg Schilling (and still
contains bugs).
| PS. As I
On 2023-10-28 18:41, Oğuz wrote:
Why? The same commands fail on bosh, yash, and zsh too.
I don't know what bosh is. zsh and yash prohibit trailing spaces in
integers, but allow leading spaces:
% test ' 3' -lt ' 4'
% test ' 3 ' -lt ' 4 '
test: integer expression expected: 3
On Saturday, October 28, 2023, Paul Eggert wrote:
> Bash should treat trailing whitespace the same way it treats leading
> whitespace,
Why? The same commands fail on bosh, yash, and zsh too.
--
Oğuz
Consider the following shell script 'doit':
sp=' '
nl='
'
test "${sp}1${sp}" -lt "${sp}2${sp}"
test "${nl}3${sp}" -lt "${nl}4${sp}"
test "${sp}5${nl}" -lt "${sp}6${nl}"
test "${nl}7${nl}" -lt "${nl}8${nl}"
Running the command "bash doit" outputs:
doit: line 6: test: 5
: integer expression
11 matches
Mail list logo