Re: Fw: OT - Getting fired for database oops

  • From: Jared Still <jkstill@xxxxxxxxx>
  • To: yong321@xxxxxxxxx
  • Date: Tue, 19 May 2009 12:19:59 -0700

On Tue, May 19, 2009 at 11:15 AM, Yong Huang <yong321@xxxxxxxxx> wrote:

>
> Jared,
>
> What is that xtitle function? Does that only work in xterm? Thanks!
>

Yes, it works in xterm to set the window title.

It also works in Putty.

I use ksh for my accounts, and bash for oracle accounts.

Following are the xtitle functions I use.

# put a new title on xterm window
function xtitle {
   if [ "$TERM" = "xterm2" -o "$TERM" = "xterm" ] ;then
      echo '^[]0;'${*}'^G'"\c"
   else
      echo 'Sorry, this is not an xterm window'
   fi
}

# bash version of xtitle
#function xtitle {
   #typeset title=$*
   #if [ "$TERM" = "xterm2" -o "$TERM" = "xterm" ] ;then
      #export PROMPT_COMMAND='echo -ne "\033]0;"'$title'" -
${USER}@${HOSTNAME}:
${PWD}\007"'
   #else
      #echo 'Sorry, this is not an xterm window'
   #fi
#}

# do not call mx from other functions, such as go(), as mx will mess up the
formatting
function my_xtitle {
   xtitle ${USER}@${MACHINE}-$(tty)
   clear # clear screen
}

# do not call mx from other functions, such as go(), as mx will mess up the
formatting
function db_xtitle {
   xtitle ${ORACLE_SID} ${USER}@${MACHINE}-$(tty)
}

Excellent documentation for xterm escape codes for different shells found
at:

http://www.faqs.org/docs/Linux-mini/Xterm-Title.html

Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: