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: David
Subject: Re: [bash 4] 'test -v 1' is never true
Date: Mon, 28 Nov 2022 00:10:15 +1100

On Mon, 28 Nov 2022 at 00:01, Alejandro Colomar <alx.manpages@gmail.com> wrote:
> On 11/27/22 12:41, Alexey wrote:
> > On 2022-11-26 21:45, Alejandro Colomar wrote:

> > I could suggest you to use for clarity another construction:
> > [[ ${1+isset} ]] || echo "not set"

> > Here "isset" is just for readability. You could place any other string 
> > literal
> > there.

> I actually find that very confusing.  What feature is it using?  I couldn't 
> find
> it with `info bash | less` then `/\+`.

See:
https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion
- Under heading: ${parameter:+word}
- The parameter is 1
- The word is isset
- The colon ':' is optional, explained by the sentences beginning with
"Omitting the colon" ..



reply via email to

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