From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 442 invoked from network); 27 Aug 2004 15:57:51 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 27 Aug 2004 15:57:51 -0000 Received: (qmail 8062 invoked from network); 27 Aug 2004 15:57:45 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Aug 2004 15:57:45 -0000 Received: (qmail 4062 invoked by alias); 27 Aug 2004 15:57:02 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7939 Received: (qmail 4052 invoked from network); 27 Aug 2004 15:57:01 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 27 Aug 2004 15:57:01 -0000 Received: (qmail 5276 invoked from network); 27 Aug 2004 15:55:03 -0000 Received: from mail36.messagelabs.com (193.109.254.211) by a.mx.sunsite.dk with SMTP; 27 Aug 2004 15:54:56 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-11.tower-36.messagelabs.com!1093622094!8875258 X-StarScan-Version: 5.2.10; banners=-,-,- X-Originating-IP: [158.234.9.163] Received: (qmail 4873 invoked from network); 27 Aug 2004 15:54:54 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-11.tower-36.messagelabs.com with SMTP; 27 Aug 2004 15:54:54 -0000 Received: from trentino.logica.co.uk ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id i7RFssf6020243; Fri, 27 Aug 2004 16:54:54 +0100 Received: from trentino.logica.co.uk (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id 62157791B004; Fri, 27 Aug 2004 17:54:34 +0200 (CEST) Cc: ZSH User List X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: <20040827152008.GA19748@spiegl.de> From: Oliver Kiddle References: <20040827152008.GA19748@spiegl.de> To: Andy Spiegl Subject: Re: question about quoting % in preexec Date: Fri, 27 Aug 2004 17:54:34 +0200 Message-ID: <5422.1093622074@trentino.logica.co.uk> X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Andy Spiegl wrote: > I am using the following preexec-function to display the currently running > process in my xterm-title: > > preexec () { > print -Pn "\033]0;%n@%m <${(Vq)2}> %~\007" > print -Pn $icontitle > } > > But if I run a command with "%" in the arguments, e.g.: > date "+%Y-%m-%d %H:%M:%S" > > it leads to very unwanted results because zsh interprets it as variables. > How can I avoid this? I suppose I have to quote the %s but how? It would be easier to just split it across extra print commands: print -Pn '\033]0;%n@%m <' print -rn -- "${(Vq)2}" print -Pn '> %~\007' The -r option does raw output so no escapes are interpreted. Oliver