bug-bash
[Top][All Lists]
Advanced

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

Re: Question about Xterm title


From: Al Elgert
Subject: Re: Question about Xterm title
Date: Thu, 17 Feb 2005 16:12:49 +0100
User-agent: Mutt/1.5.2i

Serge Koksharov schrieb am 13.02.2005 um 22:52:28 (+0300):
>   Hello, dear all!
> 
> I am bash v3.0 user. Often I need to run long-lived foreground tasks and I
> wish the name of the task with its arguments to be shown in the Xterm title.
> Much like preexec() function from zsh. I'm very happy with bash, and don't
> want to change my shell, but I'm badly need this feature. I haven't found any
> clues in documentation of bash how to achieve this. May be I missed
> something? Thank you!

Hello,

you can change the title with this command (if the term supports it):

        echo -en "\033]0;--- $HOSTNAME $TERM $$ ---\007"
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^

google(xterm-control sequences)
        ==> http://www.kitebird.com/csh-tcsh-book/ctlseqs.pdf
        ==> http://www.xfree86.org/snapshot/ctlseqs.html

greetings,
        Alexander Elgert

----------------------------------------------------------------
PS: I've created a shell function for myself to do check if it is an
    xterm and interactive.

title is a function
title () 
{ 
    title=$1;
    interactive && [ "$TERM" = "xterm" ] && echo -en "\033]0;address@hidden"
}
interactive is a function
interactive () 
{ 
    case "$-" in 
        *i*)
            return 0
        ;;
        *)
            return 2
        ;;
    esac
}





reply via email to

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