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

Re: bash: display running foreground command in xterm title

* Michael Heironimus (mkh01@earthlink.net) [030702 15:05]:
> On Wed, Jul 02, 2003 at 01:20:31AM +0200, Sebastian Kapfer wrote:
> > and pushes the Enter key - how will I know? csh seems to have a precmd
> > function which the user can define and which is executed before each
> > command. The only thing that comes close in bash is PROMPT_COMMAND. But
> > that's obviously executed _after_ a command was run.
> If you're willing to make a minor change you could switch from bash to
> zsh. zsh has a "preexec" function that runs after hitting Enter and
> before starting the program. bash and zsh are extremely similar for
> interactive use - they're both Bourne shells and they both support
> almost all of the same command-line features like completion, history,
> emacs/vi line editing, etc. Configuration is a little different, though.

Word.  And just for the record, here's what I'm using in my .zshrc:

#window titles
case $TERM in
        preexec () {print -Pn "\ek$1\e\\\\\e]0;%n@%m: $1\a"}
        chpwd () {print -Pn "\e]0;%n@%m: %~\a"}
        preexec () {print -Pn "\e]0;%n@%m: $1\a"}
        chpwd () {print -Pn "\e]0;%n@%m: %~\a"}

good times,
"Extremism in the defense of liberty is no vice.
Moderation in the pursuit of justice is no virtue."  -- Barry Goldwater 

Attachment: signature.asc
Description: Digital signature

Reply to: