[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: jobname xterm title in bash?



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!

-- 
 .~.
 /V\   Lance Simmons
/( )\  lance@lsimmons.net
^^-^^



Reply to: