tags:

views:

83

answers:

1

How can you convert the following command for Ubuntu's ZSH?

DavidPashley's command for Bash

trap 'echo -e "\e]0;$BASH_COMMAND\007"' DEBUG
if [ "$SHELL" = '/bin/bash' ]
then
    case $TERM in
         rxvt|*term)
            set -o functrace
            trap 'echo -ne "\e]0;$BASH_COMMAND\007"' DEBUG
            export PS1="\e]0;$TERM\007$PS1"
         ;;
    esac
fi
+2  A: 

I have this in my ~/.zshrc

case $TERM in
    *xterm*|rxvt|(dt|k|E)term)
        precmd () {
            print -Pn "\033]0;%n@%m : %~\007"
        }
        preexec () {
            print -Pn "\033]0;%n@%m : <$1>\007"
        }
        ;;
esac
anthony
Your command does not work in my zsh 4.3.9 (i686-pc-linux-gnu). What else do you have in your .zshrc?
Masi
does your terminal not match that pattern? What does 'echo $TERM' say?
anthony
It says ´xterm´.
Masi
not sure why it isn't working. I'm running zsh 4.3.9 as well. just to verify, you put this in $HOME/.zshrc, and then opened a new terminal after modifying your rc file?
anthony
@anthony: I did that. What do you have before `case $TERM in`?
Masi