From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15841 invoked by alias); 19 Aug 2010 14:50: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: 15295 Received: (qmail 7670 invoked from network); 19 Aug 2010 14:50:21 -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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 74.125.83.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=p8jRdjg4jLjflnoscOW6UfrHWDQ/6Bhms3+tLexu5eI=; b=FsVYHhlsTmxAyclShq1xbXjwVwQu8GKBXkRBF2IW9hURtSjh3z/I1XpZHKjvI6jx5T KuOOOOZ5bC6uJcAfNGtPJ6qKWWBKdHxjQw3U6rQVxtQGzY7dT3pGm3suSLj7D1kSTmuR vQAMwyt/H1R+CuVhu9WyYO8D+48wI2IKfGyPY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=WEJjV12yNwITJ8r0k+7uc27syJhQ9lYhoJkF4ph+W89VdZ5UhXQQhm7/xYo1pYIHls jhlPK7bI/O9qS7vK7vcfpcEg6ySOOakiTe8QrTrVLZnm3V4cd+5oPwxYb/L++UF7n+US WDalAItcyN0wYHSjtIwFA58/FfL8G5mliq+h4= MIME-Version: 1.0 From: Guillaume Brunerie Date: Thu, 19 Aug 2010 16:26:24 +0200 Message-ID: Subject: Setting the terminal title: problem with percent signs To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=001636b2b1676d1da3048e2df8d8 --001636b2b1676d1da3048e2df8d8 Content-Type: text/plain; charset=UTF-8 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 --001636b2b1676d1da3048e2df8d8--