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

Re: Modifiers and parameter expansion?



On Thu, Dec 1, 2022 at 2:39 PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> I cannot find anything in the man page that suggest it would work
> this way.  All occurences of modifiers used with parameters put
> them in braces.  The rule from the man page:
>
>        7. Modifiers

That rule is just telling you at what point during all possible
expansions the effects of modifiers come into play, it's unrelated to
the syntax.

In the Parameter Expansion section

${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.
     In addition, more complicated forms of substitution usually require
     the braces to be present; exceptions, which only apply if the
     option KSH_ARRAYS is not set, are a single subscript or any colon
     modifiers appearing after the name, or any of the characters '^',
     '=', '~', '#' or '+' appearing before the name, all of which work
     with or without braces.

Note "exceptions ... are a single subscript or any colon modifiers
appearing after the name ..."




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