bug-bash
[Top][All Lists]
Advanced

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

Re: ${| command; } funsub not setting REPLY does not error out with 'set


From: Zachary Santer
Subject: Re: ${| command; } funsub not setting REPLY does not error out with 'set -u' active
Date: Wed, 25 Dec 2024 08:36:26 -0500

On Tue, Dec 24, 2024 at 7:51 PM Lawrence Velázquez <vq@larryv.me> wrote:
>
> On Tue, Dec 24, 2024, at 12:10 PM, Zachary Santer wrote:
> > Some other nonsense real quick:
> >
> > zsant@Zack2021HPPavilion MSYS ~/repos/bash
> > $ : ${|  REPYL="whatever"}
> > ; }
> > bash: syntax error near unexpected token `;' while looking for matching `}'
> > bash: DEBUG warning: current_token (10) != shell_eof_token (})
> > bash: syntax error
>
> What do you expect to happen here?

I was thinking that maybe this had left the parser in an invalid
state. I'm not used to seeing "DEBUG warning" ever, but maybe that's
just enabled for non-release versions of bash?

> > zsant@Zack2021HPPavilion MSYS ~/repos/bash
> > $ : ${|  REPYL="whatever"; }
> > bash:  : command not found
> >
> > zsant@Zack2021HPPavilion MSYS ~/repos/bash
> > $ : ${| REPYL="whatever"; }
> > bash:  REPYL=whatever: command not found
> >
> > zsant@Zack2021HPPavilion MSYS ~/repos/bash
> > $ : ${| REPYL="whatever"; }
> > bash:  REPYL=whatever: command not found
>
> The second and third examples above look exactly the same.  Are
> they supposed to differ somehow?

They are the same. I just copied what I had in the terminal verbatim.

> Anyway, I'm not seeing these errors.  Judging from the messages,
> I'd guess that you accidentally introduced a nonblank whitespace
> character immediately after '${|'.
>
>         bash-5.3$ : ${| REPYL="whatever"; }
>         bash-5.3$ LC_ALL=en_US.UTF-8
>         bash-5.3$ nbsp=$'\uA0'
>         bash-5.3$ eval ': ${|'"$nbsp"' REPYL="whatever"; }'
>         bash:  : command not found
>         bash-5.3$ eval ': ${|'"$nbsp"'REPYL="whatever"; }'
>         bash:  REPYL=whatever: command not found

You're right. That's exactly what happened. I'd started with something
I copied from the email I was writing. I've already seen that gmail
will intersperse non-breaking spaces among a run of multiple spaces, I
guess so HTML will still display it in a way that looks right.

> > zsant@Zack2021HPPavilion MSYS ~/repos/bash
> > $ : ${|
> >  REPYL="whatever"
> > }
> >
> > The first thing within a ${| command; } funsub has to be a command if
> > it's on the same line as ${| ?
>
> No.

Sorry for the noise.

Attachment: NBSP.png
Description: PNG image


reply via email to

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