Re: manipulating PS1 in sh




Jordan Abel wrote:
2006-10-27 <1161979585.383055.236660@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
EdStevens wrote:
Trying to set PS1 to reflect the current value of a user environment
variable, when running in sh.

Most of my systems I am running in ksh, and my PS is set as follows:

export PS1=`hostname`'.''$ORACLE_SID> '

so that my prompt always shows the current value of $ORACLE_SID. But
it appears that this syntax doesn't yeild the same results with sh.
There, instead of returning the value of $ORACLE_SID, it simply returns
the literal "$ORACLE_SID".

$ORACLE_SID isn't going to change on you in the middle of a session
unless you eval something that explicitly changes it.

Ah, but it does legitimately change quite often .. at my direction.
See my final comment, below.

The simple solution is to simply run ksh (my preference) but that
presents certain, uh, political challenges. Is there a simple way of
achieving this same functionality under sh (Solaris 5.9)?

Under what circumstances does this change?

That variable is used by Oracle to designate the 'current default'
database, allowing a simpler 'connect' command -- not having to specify
a lengthy connect string that explicitly states which database I want
to work with. Quite handy on a system that is hosting multiple
databases.

.