Cannot figure out how to make csh alias to set xterm title

All I want to do is make a simple alias that changes xterm window title to current hostname. Completely easy to do with bash, but I need to do it for csh.

Anything I try, it just echoes the line back with the hostname, doesn't put it in window title. For example:

Code:
pingy@pit87% alias mytitle 'echo -n ^[]1\;$HOST\^G'
pingy@pit87% mytitle
^[]1;pit87.pair.com^Gpingy@pit87%

It's just not escaping. What am I doing wrong?
 
Here's mine, the tricky bit is the correct escape sequences.

Code:
switch($TERM)
        case "xterm*":
                setenv TITLE "%{\033]0;%n@%m:%~\007%}"
                breaksw
        default:
                setenv TITLE ""
                breaksw
endsw

I've added this to my .cshrc hence the check on TERM. I use it a bit further on to set the prompt:
Code:
set prompt = "${TITLE}%n@%m:%~%#"

This will set the prompt as well as the window's title.
 
Back
Top