On 20-Apr-98 Norbert Veber wrote: > Is there a simple way to make xterms display the current command > beeing executed in the window? By simple I mean without patching and > recompiling bash and/or xterm. I know that you can change the title > using the -T command line option, but I want it to change dynamically > depending on what I'm doing in that xterm. This would work nicelly > with afterstep's window list module. > > To make it display the current path, something like this can be used > (in bash): > PS1='([EMAIL PROTECTED]:\w)% \[\033]0;\w\007\]' > > But how can I make it display the name of the command? >
Changing the title bar dynamically can be done with the PROMPT_COMMAND environment variable (in bash). In my bashrc I have: function settitle { # title="[EMAIL PROTECTED]:(`date +%k:%M:%S`):`pwd`" title="[EMAIL PROTECTED]:(`date +%k:%M:%S`):`history 1`" echo -n "^[]2;$title^G" > /dev/tty } if [ $TERM = "xterm" ] || [ $TERM = "xterm-color" ]; then PROMPT_COMMAND=settitle PS1='\h:\u > ' fi The first title assignment is useful when I want to know the current directory while having a small prompt. Also for telling when an xterm was last used. The second one only lists the last command executed. Don't know how to list the current one. Hope this helps! (thanks go to Glynn Clements on linux-admin for this tid-bit) Mike Brownlow <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]