Operating System - HP-UX
1752728 Members
5879 Online
108789 Solutions
New Discussion юеВ

Display dinamically the ORACLE_SID variable value in PS1

 
SOLVED
Go to solution
gaudiobe
Advisor

Display dinamically the ORACLE_SID variable value in PS1

I'm triyng to dysplay the $ORACLE_SID value on the prompt.
After setting the ORACLE_SID by command line I wolud like to see it in the prompt.
I tried to change it in the PS1 variable in .profile file but my attempt was unsuccessfully:
PS1="$(echo $ORACLE_SID):\$PWD>

Example:
ORADB1:\> export ORACLE_SID=ORADB2
ORADB2:\>

Have you got any suggest?

Regards,
BG
3 REPLIES 3
Dennis Handly
Acclaimed Contributor
Solution

Re: Display dinamically the ORACLE_SID variable value in PS1

The trick is to use single quotes:
PS1='$ORACLE_SID:$PWD> '
Joseph Steinhauser
New Member

Re: Display dinamically the ORACLE_SID variable value in PS1

Try this in ksh or sh-posix:

export PS1='${ORACLE_SID:-NoSID},${LOGNAME}[${PWD##*/}]$ '

It should include SID,User, and short PWD in your prompt. Also, if SID is ever unset/null then your prompt will tell you.
Old School efficiency. New World Tools.
gaudiobe
Advisor

Re: Display dinamically the ORACLE_SID variable value in PS1

Solved.

Thanks for the great support.

Regards,
BG