Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Prompt expansion: $((%)foo} != $(print -P $foo)
- X-seq: zsh-workers 10171
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Prompt expansion: $((%)foo} != $(print -P $foo)
- Date: Mon, 20 Mar 2000 06:45:19 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
The order in which parameter expansion vs. prompt %x expansion takes place
appears to be reversed for ${(%)...} and $(print -P ...). This is visible
in this situation:
zsh% setopt promptsubst
zsh% PS1='%$[COLUMNS-20]>...%% >some text here %% '
some text here %
The prompt and the output of "print -P" are truncated at COLUMNS-20, so in
that case the $[...] was expanded before %N>...> was parsed. However:
some text here % echo ${(%)PS1}
[COLUMNS-1]some text here %
There, %$ was taken as a prompt token (and ignored) before parameters were
expanded. A workaround is to use ${(%)${(e)PS1}}, but of course that's not
right when promptsubst is NOT set.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author