------_=_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
<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-----
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"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Unix question: how to display SID and path in prompt</TITLE>

<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=351281414-26082002><FONT face=Arial color=#0000ff size=2>Also 
be aware that when using backticks in your PS1 variable,&nbsp; you are 
influencing $? as a result.&nbsp; </FONT></SPAN></DIV>
<DIV><SPAN class=351281414-26082002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=351281414-26082002><FONT face=Arial color=#0000ff size=2>What 
happens, is that when you run a command (i.e. "rm 
&lt;some_file_that_doesnt_exist&gt;") 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.</FONT></SPAN></DIV>
<DIV><SPAN class=351281414-26082002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=351281414-26082002><FONT face=Arial color=#0000ff size=2>David 
Curiel</FONT></SPAN></DIV>
<DIV><SPAN class=351281414-26082002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Philip Douglass 
  [mailto:[EMAIL PROTECTED]]<BR><B>Sent:</B> Monday, August 26, 2002 10:03 
  AM<BR><B>To:</B> Multiple recipients of list ORACLE-L<BR><B>Subject:</B> Re: 
  Unix question: how to display SID and path in prompt<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial size=2>Put $PWD in there somewhere. I use 
  ${PWD#${PWD%%*([!/])/*([!/])}} to display the last two directory levels, so my 
  prompt never gets TOO long.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>The substring extraction&nbsp;of $PWD is ksh 
  specific. You could do it other ways, but this way it uses ksh builtins, so it 
  is _fast_</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>As an example, when I am in my $ORACLE_HOME, my 
  prompt ends up looking something like: </FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>product/8.1.7 [09:54:42 AM] 181$ </FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>where 181 is the current command history 
  number.</FONT></DIV>
  <BLOCKQUOTE dir=ltr 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 
2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
    <A [EMAIL PROTECTED] 
    href="mailto:[EMAIL PROTECTED]";>Daiminger, Helmut</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A [EMAIL PROTECTED] 
    href="mailto:[EMAIL PROTECTED]";>Multiple recipients of list ORACLE-L</A> 
    </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, August 26, 2002 9:48 
    AM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> Unix question: how to display 
    SID and path in prompt</DIV>
    <DIV><BR></DIV>
    <P><FONT size=2>Hi!</FONT> </P>
    <P><FONT size=2>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.</FONT></P>
    <P><FONT size=2># always displays host name and Oracle SID as prompt</FONT> 
    <BR><FONT size=2>PS1="`hostname`;`echo $ORACLE_SID`$ "</FONT> </P>
    <P><FONT size=2>How can I extend this prompt to also include the current 
    directory that I'm in?</FONT> </P>
    <P><FONT size=2>e.g. prod1;PCLDB1; u010/app/oracle/admin/PCLDB1</FONT> </P>
    <P><FONT size=2>Thanks,</FONT> <BR><FONT size=2>Helmut</FONT> 
</P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------_=_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).

Reply via email to