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

Re: title




If we are sharing silly shell tips, this one is a golden oldie.
Here is a variant I have in my .bashrc :

#############################################################

# let the xterm titlebar show the current dir
xtitle() {
        if [ "$TERM" = "xterm" ]; then
                echo -n -e "\033]0;$@\007" >/dev/tty
        fi
}

# Change the 'cd' 'pushd' 'popd' commands to use xtitle()
cd() {
        builtin cd $1
        xtitle ${HOSTNAME%%.*}: $PWD
}

pushd() {
        builtin pushd $1
        xtitle ${HOSTNAME%%.*}: $PWD
}

popd() {
        builtin popd $1
        xtitle ${HOSTNAME%%.*}: $PWD
}

# this will set the title upon invocation of an xterm
cd .

###############################################################

-- 
Oleg Goldshmidt | BLOOMBERG L.P. (BFM) | oleg@NOSPAM.bfr.co.il
"... We work by wit, and not by witchcraft;
 And wit depends on dilatory time." - W. Shakespeare.

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il