Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Modifiers and parameter expansion?



On Thu, Dec 1, 2022 at 5:28 PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> > ${NAME}
> >      The value, if any, of the parameter NAME is substituted.  The
> >      braces are required if the expansion is to be followed by a letter,
> >      digit, or underscore that is not to be interpreted as part of NAME.
>
> Actually that is only true for "normal" parameters.  Neither of the
> special parameters except "_" treats the following characters as
> part of the name.

The problem here is that the man page is written more colloquially
than the interpretation you're trying to put on it.  To do this
rigorously, we'd reference the grammar of an "identifier" and explain
that NAME is the maximal string of characters matching that grammar.
But that would require even more back-referencing and technical jargon
than other people already complain about.

Special parameters aren't identifiers at all, so they don't obey this
description.

> With braces, unknown modifiers are rejected,
> without braces they are used as literal text:

You've caught another place where the manual was written 30 years ago
for people who already knew how csh works.  On the list it goes for
someone with a lot of time, sigh.




Messages sorted by: Reverse Date, Date, Thread, Author