bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bash 4] 'test -v 1' is never true


From: Alejandro Colomar
Subject: Re: [bash 4] 'test -v 1' is never true
Date: Sat, 26 Nov 2022 18:45:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

Hi Chet!

On 11/26/22 18:44, Chet Ramey wrote:
On 11/25/22 4:02 PM, Alejandro Colomar wrote:
Hi!

I wrote a script, and am trying it on many systems.  On RHEL8, which has bash 4, it didn't work.  I could reduce the problem to the following command, which never returns true:

     test -v 1;

This is a bash feature. I cribbed it from ksh93, and it first appeared in
bash-4.2.

The initial implementation was restricted to shell variables -- positional
parameters like $1 are not shell variables.

After a bunch of requests, like

https://lists.gnu.org/archive/html/bug-bash/2018-12/msg00098.html
https://lists.gnu.org/archive/html/bug-bash/2018-12/msg00104.html
https://lists.gnu.org/archive/html/bug-bash/2020-01/msg00027.html

I added support for testing positional parameters in bash-5.1.

That was my gut; thanks!  I'll workaround with $#.

Cheers,

Alex


--
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]