From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16623 invoked from network); 6 Jul 2000 10:13:05 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 Jul 2000 10:13:05 -0000 Received: (qmail 21438 invoked by alias); 6 Jul 2000 10:12:43 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3257 Received: (qmail 21430 invoked from network); 6 Jul 2000 10:12:42 -0000 Date: Thu, 06 Jul 2000 11:12:12 +0100 From: Peter Stephenson Subject: Re: Probs with nested braces in PROMPT In-reply-to: "Your message of Thu, 06 Jul 2000 13:59:53 +0400." <000601bfe730$ee914ed0$21c9ca95@mow.siemens.ru> To: zsh-users@sunsite.auc.dk (Zsh users list) Message-id: <0FX900MG0TOBBR@la-la.cambridgesiliconradio.com> Content-transfer-encoding: 7BIT Andrej wrote: > > > > PROMPT='%{^[[5;46m%}%m:%l %T %~${PROJECT:+ > > %{^[[31m[%}}$PROJECT${PROJECT:+]%{^[[30m%}}%#%{^[[0m%}' > > > > What about > > PROMPT='%{^[[5;46m%}%m:%l %T %~${PROJECT:+ > %{^[[31m[%\}}$PROJECT${PROJECT:+]%{^[[30m%\}}%#%{^[[0m%}' > > (note, that `}' in %} are quoted). This seems to work. I suspect, why it > happens, but I do not know code good enugh. The problem was that ordinary ${...} doesn't know about %-substitution in prompts, nor should it (that would be a horrendous complication involving different levels of substitution). So it took the brace in `%}' as the brace closing the substitution. Andrej's solution is the easiest way round. Because of the way parameters are parsed, you could also do esc1=$'%{\e[31m%}' esc2=$'%{\e[30m%}' PROMPT='%{^[[5;46m%}%m:%l %T %~${PROJECT:+ ${esc1}[}$PROJECT${PROJECT:+]$esc2}%#%{^[[0m%}' (replace line break by a space again) which you might consider neater. You could even put the other escape sequences in that form: the $'\e' saves you having literal ASCII escapes in your text. -- Peter Stephenson Cambridge Silicon Radio, Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070