Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: unintuitive bracketing with return value
On Tue, Oct 18, 2022 at 12:33 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
>
> On Tue, Oct 18, 2022, at 1:57 PM, Ray Andrews wrote:
> > Very well written! What breaks my intuition tho is the brackets.
> > Otherwise I quite understand that the last exit value is the active
> > one. I'm expecting the brackets to 'contain' the rv of any commands
> > within the brackets. But no, the left > right rule applies and the
> > brackets don't make any difference.
>
> I don't understand why you keep saying this. Without the braces
> your command would be completely different.
I think Ray's just got the opening bracket in the wrong place. He's
describing the bracketing as if it were this:
{ "${${1}##*[*?]*}" ] &&
echo "no wildcards"; printenv "$1" } || echo wildcards present
which would do exactly what he wants.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author