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

Re: Parameter expansion flag (%) priority.



Peter Stephenson <pws@xxxxxxx>:
> Frank Terbeck wrote:
[...]
> > The 'letters in the result' led me to the assumption, that (U) would
> > be applied *after* prompt expansion is done be (%).
> > (Same applies to (L).)
> 
> Unfortunately parameter expansion does a zillion different things,
> defined by the order they happen to occur in the code, so the description
> "the result" is never going to be very helpful.  Some order dependence
> is documented and this probably ought to be.

I'm not exactly familiar with zsh's parameter expansion code, but I
can believe, that it's not the most trivial piece of code ever. :-)

> > (Background is, that someone on IRC asked for a way to lowercase the
> >  '%m' replace in the his PS1. Our proposal of %{(%L):-%n} turned out
> >  to be broken.)
> 
> That's actually easy:  ${(L):-${(%):-%n}} (or %m if that's what you
> meant).  This is fully guaranteed against programmers' whims.

Shouldn't ${(L)${(%):-%m} (yes, you're right, I meant '%m') be enough?

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



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