Lance Simmons <lance@lsimmons.net> [2002-08-20 17:20:15 -0500]: > On Sun, Aug 18, 2002 at 05:18:38PM -0500, Lance Simmons wrote: > > I'd like to be able to use bash to dynamically print the current job > > name as the xterm title. > > As it turns out, it _is_ possible to do this. In an email, Paul Jarc > explained how to do it. I've modified his suggestion. Use at least bash > 2.05b, and make sure PS1 doesn't have any xterm commands in it: > > xtitle() { echo -ne "\\E]2\;$1 $HOSTNAME\\a"; } > trap 'xtitle "[$(history 1 | cut -b 8-38)]"' DEBUG > > This puts > > "[first 30 characters of current command] $HOSTNAME" > > in your xterm title! _Very_ cool! Doesn't the DEBUG trap only operate after the command? What you need is something that is triggered before every command. Using DEBUG you get the title set to the last command you ran after the command exited. Which does not seem quite like what one would want. But I agree it is a cool use of the DEBUG trap. I had forgotten about it. Thanks for bringing it back into memory cache. Bob
Attachment:
pgp8TrTSnUzqy.pgp
Description: PGP signature