Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Unix question: how to display SID and path in prompt
Jared Writes:
>> 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
Your example is certainly more efficient, in that your the PATH information is only updated when your current directory is likely to have changed, but I actually echo every command's $? onto my prompt. i.e my prompt looks like:
RC(1) azimuth:.../last_2/path_components$
Actually, I had to create a function to do this, so that $? was properly returned.
function _cd {
typeset saverc=$? typeset _path=`echo $PWD | sed '/\/.*\/.*\//{s%.*/\(.*/.*\)%.../\1%;}' ` echo "RC($saverc) $HOST:$_path\$ " return $saverc
Otherwise if you are simply setting PS1 with backticks in the main() of your
rc file, then your $? is hosed.
At least as far as I've experienced....
Thanks
David
-----Original Message-----
Sent: Monday, August 26, 2002 12:58 PM
To: ORACLE-L_at_fatcity.com
Cc: Curiel, David
> 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)
# 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} :
alias cd='go '
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 inprompt
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: Curiel, David INET: david.curiel_at_pioneer.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 - 15:03:20 CDT
![]() |
![]() |