Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Unix question: how to display SID and path in prompt

RE: Unix question: how to display SID and path in prompt

From: <Jared.Still_at_radisys.com>
Date: Mon, 26 Aug 2002 11:08:23 -0800
Message-ID: <F001.004BFB6E.20020826110823@fatcity.com>


> Also be aware that when using backticks in your PS1 variable, you are
> influencing $? as a result.

I don't find that to be true with pdksh - PD KSH v5.2.14 99/07/13.2

function go {

   \cd $1

   typeset -Z2 _h; typeset -Z2 _m                  # 2 digits, zero padded
   _hh="(SECONDS/3600)%24" _mm="(SECONDS/60)%60" # hours, minutes    _time='${_x[(_m=_mm)==(_h=_hh)]}$_h:$_m'    typeset bold=$(tput bold)
   typeset shy=$(tput rmso)
   PS1="[ `pwd` ]"
   PS1=$PS1`echo
"\n\n${bold}$_time-${UMACHINE}:${ORACLE_SID}${shy}:${LOGNAME}-$TTY > "`

   # need to be able to turn xtitle off when using 'go'    if [ "$TERM" = "xterm2" -o "$TERM" = "xterm" ] ;then

      # don't do xtitle if NO_CD_TITLE is set or in SCREEN
      #[ "$NO_CD_TITLE" -o "$WINDOW" -ge 1 ] || xtitle ${MACHINE}:${PWD}
      :

   fi
}

alias cd='go '



10:2-rsysdevdb:dv01:jkstill-3 > rm this_file_does_not_exist rm: cannot remove `this_file_does_not_exist': No such file or directory [ /home/jkstill/tmp ]

10:2-rsysdevdb:dv01:jkstill-3 > echo $?
1
[ /home/jkstill/tmp ]

10:2-rsysdevdb:dv01:jkstill-3 > echo $?
0
[ /home/jkstill/tmp ]

10:2-rsysdevdb:dv01:jkstill-3 >

Jared

"Curiel, David" <david.curiel_at_pioneer.com> Sent by: root_at_fatcity.com
08/26/2002 08:23 AM
Please respond to ORACLE-L  

        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
        cc: 
        Subject:        RE: Unix question: how to display SID and path in prompt




Also be aware that when using backticks in your PS1 variable, you are influencing $? as a result.  

What happens, is that when you run a command (i.e. "rm <some_file_that_doesnt_exist>") and then say "echo $?", you are getting the
return code ($?) of your PS1 execution (which is likely to always be 0) - NOT the $? of the "rm" command.  

David Curiel  

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: Jared.Still_at_radisys.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Aug 26 2002 - 14:08:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US