test -lt inconsistent about white space

2023-10-28 Thread Paul Eggert
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 expe

Re: test -lt inconsistent about white space

2023-10-28 Thread Oğuz
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

Re: test -lt inconsistent about white space

2023-10-28 Thread Paul Eggert
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 Presumably

Re: test -lt inconsistent about white space

2023-10-28 Thread Robert Elz
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 unders