[Top][All Lists]

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

Re: shelltitle, window titling

From: Dan Mahoney, System Admin
Subject: Re: shelltitle, window titling
Date: Thu, 25 Aug 2005 21:03:00 -0400 (EDT)

On Thu, 25 Aug 2005, Phil!Gregory wrote:

* Dan Mahoney, System Admin <address@hidden> [2005-08-25 13:25 -0400]:
Is there any way to have command options included for certain commands?

i.e. to have some sort of script or regex look allow me to have
ssh:address@hidden, or

screen does not support this; its automatic titling stuff is relatively
simple.  Since you're running tcsh, you could use the postcmd alias to
achieve what you want.  (postcmd is tcsh's analog to zsh's preexec.)

Don't you mean precmd?

I see form my notes that the tcsh invocation to get the name of the
current command into the shelltitle is

Here's what I've got:

set prompt="%{\ek\e\\%}\%"

Note that the shell builtin "echo" and the set command both understand \e as echo, so we don't.

 alias postcmd 'echo -ne "^[k\!#:0^[\\"'

(man echo reveals that FreeBSD's echo doesn't support -e -- also, echo is probably being interpreted by tcsh's echo builtin)

so this should do roughly what you want:

 alias postcmd 'echo -ne "^[k\!#:0 \!#:$^[\\"'

Nope, gives me this:

\ekendif endif\e\\% for my first prompt (all other prompts are normal.)

What should I have my shelltitle set to?


Now, for zsh, I might do something like this:

 preexec () {
     if [[ "$TERM" == "screen" ]]; then
          local CMD="${1[(wr)^(<*|*=*|sudo|exec|-*)]} 
          echo -n "\ek$CMD\e\\"

which pulls out the first and second non-variable, non-input redirection,
non-option elements of the command line.  (It's not terribly happy if
there isn't a second (or first, for that matter) such element.)


"Don't try to out-wierd me.  I get stranger things than you free with my
breakfast cereal."

-Button seen at I-CON XVII (and subsequently purchased)

--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
ICQ: 13735144   AIM: LarpGM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]