On Fri, Feb 11, 2005 at 02:47:22PM -0600, Gerald Combs wrote:
Bonus question:
How do you insert the name of the currently-running foreground process into the xterm title bar using bash? Tcsh has the inappropriately-named "postcmd" alias that runs just before each command is executed. Putting
alias precmd 'echo -n "^[]0;Rufus [$cwd]^G"' alias postcmd 'echo -n "^[]0;Rufus \!#:0 [$cwd]^G"'
in my .login will display "Rufus vim [/the/current/directory]" in my title bar when I'm running vim, and "Rufus [/the/current/directory]" at a regular shell prompt, for example. A bit of Googling turned up a couple of message threads that said "use zsh." Thanks. Really helpful.
You probably want to insert a similar command into the PROMPT_COMMAND environment variable. It's description from the bash man page is as follows:
If set, the value is executed as a command prior to issuing each primary prompt.
It seems that bash doesn't give you the "post" command funtionality that tcsh provides.