[Top][All Lists]

[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: Sun, 27 Nov 2022 14:16:27 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

On 11/27/22 14:10, David wrote:
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

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

- 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" ..

Ahh, it was the optional-ness of ':' that bugged me. I'm also quite unaccustomed to [[ expr ]]. :)





Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

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