From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25263 invoked from network); 20 Mar 2000 12:04:28 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 20 Mar 2000 12:04:28 -0000 Received: (qmail 20335 invoked by alias); 20 Mar 2000 12:04:15 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10180 Received: (qmail 20327 invoked from network); 20 Mar 2000 12:04:14 -0000 Date: Mon, 20 Mar 2000 13:04:13 +0100 (MET) Message-Id: <200003201204.NAA10508@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Mon, 20 Mar 2000 06:45:19 +0000 Subject: Re: Prompt expansion: $((%)foo} != $(print -P $foo) Bart Schaefer wrote: > 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. Err... that's what (%%) is for. From the docs: item(tt(%))( Expand all tt(%) escapes in the resulting words in the same way as in prompts (see noderef(Prompt Expansion)). If this flag is given twice, full prompt expansion is done on the resulting words, depending on the setting of the tt(PROMPT_PERCENT), tt(PROMPT_SUBST) and tt(PROMPT_BANG) options. ) Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de