- cal 2002
- man tcsh | grep alias
- ssh me@somewhere.edu
- telnet 192.168.1.99
- top
- vi ~/Library/init/tcsh/aliases.mine
The way to do this is explained in Ric Lister's Xterm-Title Howto and is easy to summarize. First, issue the last command above ("vi ~/Lib...") to create and edit a file named 'aliases.mine' in the appropriate directory. This standard location is defined in /usr/share/init/tcsh/README. Next, type "i" and insert this line:
sched +0:00 alias postcmd 'echo -n "^[]0;\!#^G"'
As in the earlier tip, ^[ and ^G here are not to be typed literally. They are the ESC and BEL escape sequences, obtained in vi by typing ctrl-V ctrl-[ for the first one and ctrl-V ctrl-G for the second. Finally, save and close the file (esc :wq! return), open a new terminal window, and marvel.
Addendum to original story: Based on the long series of comments below, here is a version of the command to use which will not cause errors and seems to work in all situations:
sched +0:00 alias postcmd 'echo -n "^[]0; `hostname|cut -d.[space]
-f1`: `echo \\!# | cut -b 1-25`^G"'Please note it is shown on two lines, but is really one long line. Replace [space] with an actual space character and enter as one line of text. Second addendum: From the original author, here's a newer version that actually works in all situations (even the above one causes some errors in certain circumstances):
sched +0:00 alias postcmd 'printf "\033]0; %s \007" "\!#:q"'
I have tested this new version, and it works just fine in tcsh...

