Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Setting the terminal title: problem with percent signs
- X-seq: zsh-users 15295
- From: Guillaume Brunerie <guillaume.brunerie@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Setting the terminal title: problem with percent signs
- Date: Thu, 19 Aug 2010 16:26:24 +0200
- 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=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author