Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: $var not expanded in ${x?$var}
- X-seq: zsh-workers 52572
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: $var not expanded in ${x?$var}
- Date: Wed, 21 Feb 2024 20:21:50 +0000
- Archived-at: <https://zsh.org/workers/52572>
- In-reply-to: <CAH+w=7Z0Evb019EX=bLtgHh0UOPy1J-nUO5paz+AxDXTtVGNSw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh workers <zsh-workers@xxxxxxx>
- References: <20230113080246.nghigc4givvaomve@chazelas.org> <836025199.2014747.1673889335246@mail.virginmedia.com> <20240220070505.fd6jfbcdldieqv7u@chazelas.org> <CAH+w=7ajhNqwmbc_V3scgXTKJ+7BJsii3r4=q+df84-MntxNng@mail.gmail.com> <20240220193911.avnmcqfliwltkj5m@chazelas.org> <CAH+w=7YmczEa2rNa68OwUhiRArBFJ11FdwT6Qci_LmTAWFauGg@mail.gmail.com> <20240221194534.o2mufin7orng6ttg@chazelas.org> <CAH+w=7Z0Evb019EX=bLtgHh0UOPy1J-nUO5paz+AxDXTtVGNSw@mail.gmail.com>
2024-02-21 11:52:51 -0800, Bart Schaefer:
> On Wed, Feb 21, 2024 at 11:45 AM Stephane Chazelas
> <stephane@xxxxxxxxxxxx> wrote:
> >
> > 2024-02-20 20:44:47 -0800, Bart Schaefer:
> > [...]
> > > + case 'S':
> > > + str = va_arg(ap, const char *);
> > > + fprintf(file, "%s", str);
> > > + break;
> > [...]
> >
> > I suspect there's something wrong with that as it could not
> > possibly work for ${var?$'\0'}.
>
> What would you expect it to do? You can't have it both raw and not
> raw.
I would expect it to write the NUL character ('\0') to stderr,
which fprintf couldn't do as it takes a NUL-delimited string.
With the patch applied, I get:
$ (: ${1?$'a\0b'}) |& sed -n l
zsh: 1: a\203 b$
Maybe needs some unmetafy + fwrite.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author