From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8873 invoked by alias); 1 Sep 2010 13:21:26 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15345 Received: (qmail 11738 invoked from network); 1 Sep 2010 13:21:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, HTML_MESSAGE,T_DKIM_INVALID autolearn=no version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at spb.de does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spb.de; s=m1; t=1283346881; bh=TWazvKXTJblFXpm3DDZkWyzP/RUVO4KE9jJYIeOJhi8=; h=In-Reply-To:References:To:MIME-Version:Subject:Message-ID:From: Date:Content-Type; b=GcfhsTwgvU+mIvGNSiZ2umdEiKpuyVBEAeMI7v5yrMYRlS8Immp8xoqxsUasNPR1Q l8QI4/G76N+sfYKvIbnoww3iw+G3iHbps7tGA6UhhHbcbHW6iWjZPJZlfsKD2bYdc9 BbM6+lKxudmzMPcnBeOxOGUu5meCCPGdsd4De6Fg= In-Reply-To: References: To: Guillaume Brunerie , zsh-users@zsh.org MIME-Version: 1.0 Subject: Antwort: Setting the terminal title: problem with percent signs X-KeepSent: 07499B87:DB9CC3E6-C1257791:004883C8; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.1 FP1 January 06, 2010 Message-ID: <28256_1283346880_4C7E51C0_28256_605_1_OF07499B87.DB9CC3E6-ONC1257791.004883C8-C1257791.0048C01D@nbg.sdv.spb.de> From: stefan.albert@spb.de Date: Wed, 1 Sep 2010 15:14:37 +0200 X-MIMETrack: Serialize by Router on NLANGWC3/SERVER/sdv(Release 8.5.1|September 28, 2009) at 01.09.2010 15:14:40, Serialize complete at 01.09.2010 15:14:40 X-SafeGuard_MailGateway: Version: 5.60.3.10058 SGMG Date: 20100901131441Z Content-Type: multipart/alternative; boundary="=_alternative 0048C01BC1257791_=" --=_alternative 0048C01BC1257791_= Content-Type: text/plain; charset="US-ASCII" Hi, you have to substitute the % with %% Change the line : __last_cmd=$1 in something like that: __last_cmd=`echo $1 | sed -e "s/%/%%/g"` this should do the job. Stefan Von: Guillaume Brunerie An: zsh-users@zsh.org Datum: 19.08.2010 16:51 Betreff: Setting the terminal title: problem with percent signs Hi, I have the following in my .zshrc which set the terminal title to "*cmd" when cmd is executed and to "(cmd)" when execution of cmd is over. __last_cmd= preexec () { __last_cmd=$1 print -Pn "\e]0;*$__last_cmd\a" } precmd () { if [[ -n $__last_cmd ]] then print -Pn "\e]0;($__last_cmd)\a" fi } (print -Pn "\e]0;$str\a" change the terminal title to $str, see 'man console_codes') It works well, except when there are percent signs in the last command. For example if I type "echo 100%", the terminal title becomes "(echo 100)" instead of "(echo 100%)" and the string " ]0;*echo 100100%" appears in the terminal. How can I do to make it work even with percent signs in the command? Thank you Guillaume Brunerie --=_alternative 0048C01BC1257791_=--