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

Re: Modifiers and parameter expansion?

On Thu, Dec 01, 2022 at 01:36:53PM -0800, Bart Schaefer wrote:
> On Thu, Dec 1, 2022 at 1:34 PM Eric Cook <llua@xxxxxxx> wrote:
> >
> > On 12/1/22 16:29, Dominik Vogt wrote:
> > > Isn't this supposed to happen only if the parameter and modifier
> > > are put in braces?
> More specifically, Dominik is thinking in bash, whereas zsh is copying
> implementation from csh.

Actually I've never used anything but zsh unless forced to and
never tried to understand any other shell.

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
              Any modifiers, as specified by a trailing `#', `%', `/'  (possi-
              bly  doubled)  or  by a set of modifiers of the form `:...' (see
              the section `Modifiers' in the section `History Expansion'), are
              applied to the words of the value at this level.

If this rule applies to "$X:...", what is "$X%..." supposed to do?

  $ X=abc
  $ echo "$X:u" "$X%c" "${X%c}"
  ABC abc%c ab


Dominik ^_^  ^_^


Dominik Vogt

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