RE: Unix question: how to display SID and path in prompt
> -Original Message- > From: STEVE OLLIG [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 27, 2002 3:23 PM > To: Multiple recipients of list ORACLE-L > Subject: RE: Unix question: how to display SID and path in prompt > > > but the syntax IS annoying and tedious at best. speaking as > a *NIX bigot > who landed a job with a fair share of legacy VMS work that > needs doing. > > it really pisses me off when i type SHOW SYSTEM/FULL instead > of ps -efl on > my sun box ;) Whine, whine! If you don't want to abbreviate your typing with "SH SYS/F", follow this: In your SYS$LOGIN:LOGIN.COM, add this line: $ IF F$TYPE(PS).EQS."" THEN PS :== $SYS$LOGIN:PS.COM The "IF" will only define it if it hasn't already been defined. Then, from the command line, "CREATE SYS$LOGIN:PS.COM", and paste this in your terminal window: $! ps.com $! $! Quickie for Unixy-types. $! $ ON WARNING THEN EXIT $ ON CONTROL_Y THEN EXIT $! $ args = F$EDIT(p1,"UPPER,COLLAPSE") $ parm = "" $ IF args.eqs."-EFL" THEN parm = "/FULL" $ SHOW SYSTEM'parm' $! $ EXIT ...then hit to save it. No need to worry about an execution security bit on VMS for command procs. If your LOGIN.COM is fully re-entrant (most aren't), you can simply @SYS$LOGIN:LOGIN.COM to get your "ps" command, just like ". ~/.profile" for Korn. Your best bet is to logout and back in. Likewise, you can add the following quickies to your LOGIN.COM: $ cat :== type $ cd :== set default $ grep :== search $ up :== set default [-] $ ls :== directory $ ll :== directory/size=all/date=modified/columns=10/width=(file=38,size=7) Please only use these interactively. If your LOGIN.COM separates out modes of operation (e.g. "IF F$MODE().EQS."INTERACTIVE"), put these symbol refinitions in the INTERACTIVE area and not in BATCH or NETWORK. If you'd like more help with your VMS environment, give me a holler directly and we'll get you some help. Rich Jesse System/Database Administrator [EMAIL PROTECTED] Quad/Tech International, Sussex, WI USA -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Jesse, Rich INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
-- STEVE OLLIG <[EMAIL PROTECTED]> on 08/27/02 12:23:30 -0800 > but the syntax IS annoying and tedious at best. speaking as a *NIX bigot > who landed a job with a fair share of legacy VMS work that needs doing. > > it really pisses me off when i type SHOW SYSTEM/FULL instead of ps -efl on > my sun box ;) type "sho sys/ful" instead. -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
but the syntax IS annoying and tedious at best. speaking as a *NIX bigot who landed a job with a fair share of legacy VMS work that needs doing. it really pisses me off when i type SHOW SYSTEM/FULL instead of ps -efl on my sun box ;) -Original Message- [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 27, 2002 11:43 AM To: Multiple recipients of list ORACLE-L Oh I agree - it was a rock solid platform, but the syntax was annoying and tedious at best. Scott Shafer San Antonio, TX 210.581.6217 > -Original Message- > From: Steven Lembark [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, August 27, 2002 11:13 AM > To: Multiple recipients of list ORACLE-L > Subject: RE: Unix question: how to display SID and path in prompt > > > > -- [EMAIL PROTECTED] > > > Obviously. If you had worked on VMS, why would you want to emulate it? > > Actually the platform had a number of virtues -- file > versions not the least, along with separate system access. > DCL itself had some nice features, if they'd only added > pipes it would've been equivalent to most *NIX shells w/ > the added benefit of lexical var's. > > > > -- > Steven Lembark 2930 W. Palmer > Workhorse Computing Chicago, IL 60647 > +1 800 762 1582 > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: Steven Lembark > INET: [EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] (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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: STEVE OLLIG INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
-- "Jesse, Rich" <[EMAIL PROTECTED]> > Starting in VMS 7.0 or 7.1 (I forget which), you *can* use pipes: > > $ GREP := SEARCH SYS$PIPE > $ PIPE SHOW SYSTEM | GREP ora_ > > And it gets even better with "SET PROCESS/PARSE=EXTENDED" on the Alphas... > > :) Uncle Kenny's ghost can enjoy them; the rest of us are on *NIX :-) -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Steven Lembark INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
Starting in VMS 7.0 or 7.1 (I forget which), you *can* use pipes: $ GREP := SEARCH SYS$PIPE $ PIPE SHOW SYSTEM | GREP ora_ And it gets even better with "SET PROCESS/PARSE=EXTENDED" on the Alphas... :) Rich Jesse System/Database Administrator [EMAIL PROTECTED] Quad/Tech International, Sussex, WI USA > -Original Message- > From: Steven Lembark [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 27, 2002 11:13 AM > To: Multiple recipients of list ORACLE-L > Subject: RE: Unix question: how to display SID and path in prompt > > > > > -- [EMAIL PROTECTED] > > > Obviously. If you had worked on VMS, why would you want to > emulate it? > > Actually the platform had a number of virtues -- file > versions not the least, along with separate system access. > DCL itself had some nice features, if they'd only added > pipes it would've been equivalent to most *NIX shells w/ > the added benefit of lexical var's. -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Jesse, Rich INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
Oh I agree - it was a rock solid platform, but the syntax was annoying and tedious at best. Scott Shafer San Antonio, TX 210.581.6217 > -Original Message- > From: Steven Lembark [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, August 27, 2002 11:13 AM > To: Multiple recipients of list ORACLE-L > Subject: RE: Unix question: how to display SID and path in prompt > > > > -- [EMAIL PROTECTED] > > > Obviously. If you had worked on VMS, why would you want to emulate it? > > Actually the platform had a number of virtues -- file > versions not the least, along with separate system access. > DCL itself had some nice features, if they'd only added > pipes it would've been equivalent to most *NIX shells w/ > the added benefit of lexical var's. > > > > -- > Steven Lembark 2930 W. Palmer > Workhorse Computing Chicago, IL 60647 > +1 800 762 1582 > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: Steven Lembark > INET: [EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] (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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
-- [EMAIL PROTECTED] > Obviously. If you had worked on VMS, why would you want to emulate it? Actually the platform had a number of virtues -- file versions not the least, along with separate system access. DCL itself had some nice features, if they'd only added pipes it would've been equivalent to most *NIX shells w/ the added benefit of lexical var's. -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Steven Lembark INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
Eve rocks? -Original Message- [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 27, 2002 10:53 AM To: Multiple recipients of list ORACLE-L Obviously. If you had worked on VMS, why would you want to emulate it? Scott Shafer San Antonio, TX 210.581.6217 > -Original Message- > From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] > Sent: Monday, August 26, 2002 7:13 PM > To: Multiple recipients of list ORACLE-L > Subject: RE: Unix question: how to display SID and path in prompt > > Mladen, > > Your magnificent intuition and superior powers of reasoning > have finally failed you. > > I've never touched VMS. ;) > > Jared > > > > > > > "Gogala, Mladen" <[EMAIL PROTECTED]> > Sent by: [EMAIL PROTECTED] > 08/26/2002 01:28 PM > Please respond to ORACLE-L > > > To: Multiple recipients of list ORACLE-L > <[EMAIL PROTECTED]> > cc: > Subject:RE: Unix question: how to display SID and path in > prompt > > > Jared, the "alias cd='go'" line immediately betrays you as a > former VMS person. Next thing you know and your aliases will > be like "set_def"" > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Monday, August 26, 2002 3:08 PM > > To: Multiple recipients of list ORACLE-L > > 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. > > > > 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" <[EMAIL PROTECTED]> > > Sent by: [EMAIL PROTECTED] > > 08/26/2002 08:23 AM > > Please respond to ORACLE-L > > > > > > To: Multiple recipients of list ORACLE-L > > <[EMAIL PROTECTED]> > > 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 > > ") 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: [EMAIL PROTECTED] > > > > 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: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and
RE: Unix question: how to display SID and path in prompt
Obviously. If you had worked on VMS, why would you want to emulate it? Scott Shafer San Antonio, TX 210.581.6217 > -Original Message- > From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] > Sent: Monday, August 26, 2002 7:13 PM > To: Multiple recipients of list ORACLE-L > Subject: RE: Unix question: how to display SID and path in prompt > > Mladen, > > Your magnificent intuition and superior powers of reasoning > have finally failed you. > > I've never touched VMS. ;) > > Jared > > > > > > > "Gogala, Mladen" <[EMAIL PROTECTED]> > Sent by: [EMAIL PROTECTED] > 08/26/2002 01:28 PM > Please respond to ORACLE-L > > > To: Multiple recipients of list ORACLE-L > <[EMAIL PROTECTED]> > cc: > Subject:RE: Unix question: how to display SID and path in > prompt > > > Jared, the "alias cd='go'" line immediately betrays you as a > former VMS person. Next thing you know and your aliases will > be like "set_def"" > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Monday, August 26, 2002 3:08 PM > > To: Multiple recipients of list ORACLE-L > > 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. > > > > 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" <[EMAIL PROTECTED]> > > Sent by: [EMAIL PROTECTED] > > 08/26/2002 08:23 AM > > Please respond to ORACLE-L > > > > > > To: Multiple recipients of list ORACLE-L > > <[EMAIL PROTECTED]> > > 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 > > ") 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: [EMAIL PROTECTED] > > > > 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: [EMAIL PROTECTED] (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 ma
RE: Unix question: how to display SID and path in prompt
-- John Kanagaraj <[EMAIL PROTECTED]> > Mladen, > > Are you confusing this on account of your new-found attraction to the 'go' > command in MS SQL Server (formerly Sybase and T-SQL)? :-) > > I though that 'SET DEFAULT [Dir-name]' was the equivalent of 'cd' in > VMS... They have nothing whatsoever to do with each other, mainly becuase VMS doesn't really have the same notion of "working directory" that *NIX does. set def can accept a partial path (e.g., 'dka0:', '[sys.foobar]', or 'dka0:[sys.foobar].exe'). It takes whatever you give it as a default for commands which require a filename and uses them as the default portion of the name if one is not given (e.g., "del myfile" would take the device, dir & extension from the default). You can be working on dka100: and perform a set def dka0: without effecting the O/S treatment of dka0: -- the items given to set def needn't even exist since they are not used until the next time a path is given without that portion (e.g., you can put in a bogus device w/ valid directory and not know it until you forget to type the device). cd actually changes the O/S' view of your process and the destination path you give it. Performing a cd across file systems, for example, will leave the new one unable to umount; on VMS it wouldn't effect anything. You also cannot cd to a nonexistant directory. The two commands feel the same syntatically because you normally use relative paths after performing them; but the O/S' treatments are entirely different. enjoi. -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Steven Lembark INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
Mladen, Are you confusing this on account of your new-found attraction to the 'go' command in MS SQL Server (formerly Sybase and T-SQL)? :-) I though that 'SET DEFAULT [Dir-name]' was the equivalent of 'cd' in VMS... John Kanagaraj Oracle Applications DBA DBSoft Inc (W): 408-970-7002 Disappointments are inevitable in Life, but discouragement is optional. You decide! ** The opinions and statements above are entirely my own and not those of my employer or clients ** > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 26, 2002 5:13 PM > To: Multiple recipients of list ORACLE-L > Subject: RE: Unix question: how to display SID and path in prompt > > > Mladen, > > Your magnificent intuition and superior powers of reasoning > have finally failed you. > > I've never touched VMS. ;) > > Jared > > > > > > > "Gogala, Mladen" <[EMAIL PROTECTED]> > Sent by: [EMAIL PROTECTED] > 08/26/2002 01:28 PM > Please respond to ORACLE-L > > > To: Multiple recipients of list ORACLE-L > <[EMAIL PROTECTED]> > cc: > Subject:RE: Unix question: how to display SID > and path in prompt > > > Jared, the "alias cd='go'" line immediately betrays you as a > former VMS person. Next thing you know and your aliases will > be like "set_def"" > -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: John Kanagaraj INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
Mladen, Your magnificent intuition and superior powers of reasoning have finally failed you. I've never touched VMS. ;) Jared "Gogala, Mladen" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 08/26/2002 01:28 PM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> cc: Subject: RE: Unix question: how to display SID and path in prompt Jared, the "alias cd='go'" line immediately betrays you as a former VMS person. Next thing you know and your aliases will be like "set_def"" > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 26, 2002 3:08 PM > To: Multiple recipients of list ORACLE-L > 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. > > 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" <[EMAIL PROTECTED]> > Sent by: [EMAIL PROTECTED] > 08/26/2002 08:23 AM > Please respond to ORACLE-L > > > To: Multiple recipients of list ORACLE-L > <[EMAIL PROTECTED]> > 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 > ") 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: [EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] (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). > -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Gogala, Mladen INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
That makes sense. I didn't see how my prompt would be effected other than by changing dirs, but you never know... Jared "Curiel, David" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 08/26/2002 01:03 PM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> cc: Subject: 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 That would be because in your example, PS1 is only being affected when you actually do a 'cd' In my case, (and I think that of the original poster), PS1 is being specified in the main body of my bash/ksh rc file, in which case it is evaluated every time you do any/every command. 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 } PS1='`_cd`' 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: [EMAIL PROTECTED] 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) 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" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 08/26/2002 08:23 AM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> 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 ") 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
-- "Curiel, David" <[EMAIL PROTECTED]> on 08/26/02 12:03:20 -0800 > 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 And, what's more, you don't need to backtick the stuff during normal operation: the host and username won't normally change and PWD is a reasonable approximation of where you are. -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
Jared, the "alias cd='go'" line immediately betrays you as a former VMS person. Next thing you know and your aliases will be like "set_def"" > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 26, 2002 3:08 PM > To: Multiple recipients of list ORACLE-L > 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. > > 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" <[EMAIL PROTECTED]> > Sent by: [EMAIL PROTECTED] > 08/26/2002 08:23 AM > Please respond to ORACLE-L > > > To: Multiple recipients of list ORACLE-L > <[EMAIL PROTECTED]> > 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 > ") 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: [EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] (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). > -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Gogala, Mladen INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
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 That would be because in your example, PS1 is only being affected when you actually do a 'cd' In my case, (and I think that of the original poster), PS1 is being specified in the main body of my bash/ksh rc file, in which case it is evaluated every time you do any/every command. 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 } PS1='`_cd`' 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: [EMAIL PROTECTED] 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) 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" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 08/26/2002 08:23 AM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> 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 ") 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
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. 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" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 08/26/2002 08:23 AM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> 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 ") 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
Re: Unix question: how to display SID and path in prompt
-- Philip Douglass <[EMAIL PROTECTED]> > The substring extraction of $PWD is ksh specific. You could do it other > ways, but this way it uses ksh builtins, so it is _fast_ bash and most recent sh imlementations also support the ksh-style variable munging. bash makes it even simpler by adding escape sequences for PS1: \u = user \h = host \W = basename( $PWD ) \$ = '#' if SU else '$'. so: PS1='\u@\h:\W \$ '; gives username@hostname:dirname $ for normal users or ending with '#' if you are SU. -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Steven Lembark INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: Unix question: how to display SID and path in prompt
--_=_NextPart_001_01C24D0B.863A4560 Content-Type: text/plain; charset="iso-8859-1" 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 ") 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 -Original Message- Sent: Monday, August 26, 2002 10:03 AM To: Multiple recipients of list ORACLE-L Put $PWD in there somewhere. I use ${PWD#${PWD%%*([!/])/*([!/])}} to display the last two directory levels, so my prompt never gets TOO long. The substring extraction of $PWD is ksh specific. You could do it other ways, but this way it uses ksh builtins, so it is _fast_ As an example, when I am in my $ORACLE_HOME, my prompt ends up looking something like: product/8.1.7 [09:54:42 AM] 181$ where 181 is the current command history number. - Original Message - To: Multiple recipients of list ORACLE-L <mailto:[EMAIL PROTECTED]> Sent: Monday, August 26, 2002 9:48 AM Hi! In my .profile of the oracle user (we're mostly using ksh here), I have set up the prompt that it gives me the host name and database SID. # always displays host name and Oracle SID as prompt PS1="`hostname`;`echo $ORACLE_SID`$ " How can I extend this prompt to also include the current directory that I'm in? e.g. prod1;PCLDB1; u010/app/oracle/admin/PCLDB1 Thanks, Helmut --_=_NextPart_001_01C24D0B.863A4560 Content-Type: text/html; charset="iso-8859-1" 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 -Original Message-From: Philip Douglass [mailto:[EMAIL PROTECTED]]Sent: Monday, August 26, 2002 10:03 AMTo: Multiple recipients of list ORACLE-LSubject: Re: Unix question: how to display SID and path in prompt Put $PWD in there somewhere. I use ${PWD#${PWD%%*([!/])/*([!/])}} to display the last two directory levels, so my prompt never gets TOO long. The substring extraction of $PWD is ksh specific. You could do it other ways, but this way it uses ksh builtins, so it is _fast_ As an example, when I am in my $ORACLE_HOME, my prompt ends up looking something like: product/8.1.7 [09:54:42 AM] 181$ where 181 is the current command history number. - Original Message - From: mailto:[EMAIL PROTECTED]";>Daiminger, Helmut To: mailto:[EMAIL PROTECTED]";>Multiple recipients of list ORACLE-L Sent: Monday, August 26, 2002 9:48 AM Subject: Unix question: how to display SID and path in prompt Hi! In my .profile of the oracle user (we're mostly using ksh here), I have set up the prompt that it gives me the host name and database SID. # always displays host name and Oracle SID as prompt PS1="`hostname`;`echo $ORACLE_SID`$ " How can I extend this prompt to also include the current directory that I'm in? e.g. prod1;PCLDB1; u010/app/oracle/admin/PCLDB1 Thanks, Helmut --_=_NextPart_001_01C24D0B.863A4560-- -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Curiel, David INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
Re: Unix question: how to display SID and path in prompt
Title: Unix question: how to display SID and path in prompt Put $PWD in there somewhere. I use ${PWD#${PWD%%*([!/])/*([!/])}} to display the last two directory levels, so my prompt never gets TOO long. The substring extraction of $PWD is ksh specific. You could do it other ways, but this way it uses ksh builtins, so it is _fast_ As an example, when I am in my $ORACLE_HOME, my prompt ends up looking something like: product/8.1.7 [09:54:42 AM] 181$ where 181 is the current command history number. - Original Message - From: Daiminger, Helmut To: Multiple recipients of list ORACLE-L Sent: Monday, August 26, 2002 9:48 AM Subject: Unix question: how to display SID and path in prompt Hi! In my .profile of the oracle user (we're mostly using ksh here), I have set up the prompt that it gives me the host name and database SID. # always displays host name and Oracle SID as prompt PS1="`hostname`;`echo $ORACLE_SID`$ " How can I extend this prompt to also include the current directory that I'm in? e.g. prod1;PCLDB1; u010/app/oracle/admin/PCLDB1 Thanks, Helmut
Re: Unix question: how to display SID and path in prompt
-- "Daiminger, Helmut" <[EMAIL PROTECTED]> > Hi! > > In my .profile of the oracle user (we're mostly using ksh here), I have > set up the prompt that it gives me the host name and database SID. > ># always displays host name and Oracle SID as prompt > PS1="`hostname`;`echo $ORACLE_SID`$ " > > How can I extend this prompt to also include the current directory that > I'm in? > > e.g. prod1;PCLDB1; u010/app/oracle/admin/PCLDB1 Back-ticks can be a pain to track, the $() notation in ksh makes things a bit less error prone. Also, no need to echo a variable via shell execution if it is available in the current proc: PS1="$(hostname):$ORACLE_SID:\$PWD \$ "; will give you the full path or PS1="$(hostname:$ORACLE_SID:./\${PWD##*/} \$ "; will give you the relative path (i.e., $PWD stripped of any text leading to a '/'). This is equivalent to bash's: PS1='\h:$ORACLE_SID:\W \$ '; -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Steven Lembark INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).