Re: manipulating PS1 in sh




Radoulov, Dimitre 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".
[...]

$ PS1=`hostname`'.''$ORACLE_SID> '
xxx.ora10gr2> sh
xxx.$ORACLE_SID> PS1="`hostname`.$ORACLE_SID>"
xxx.ora10gr2>


Regards
Dimitre

Which returns the LITERAL "$ORACLE_SID". I need the VALUE of the
ORACLE_SID variable, like this:

$> ORACLE_SID=db01
$> echo $ORACLE_SID
$> db01
$> PS1= "`hostname`'.'?????'>'
db01>
db01> ORACLE_SID=db02
db02> echo $ORACLE_SID
db02> db02

.



Relevant Pages

  • Re: Using Bash to get the last line of a file
    ... "Radoulov, Dimitre" wrote in message ... ... "Spiros Bousbouras" wrote ... ... echo "${f/* ...
    (comp.unix.shell)
  • Re: Using Bash to get the last line of a file
    ... "Radoulov, Dimitre" wrote in message ... ... "Spiros Bousbouras" wrote ... ... echo "${f/* ...
    (comp.unix.shell)
  • Re: SPAM: [SLE] Cant run this script
    ... The error is redirected to "err". ... Yes, because ls is not a bash built-in, but echo and time are. ... Well..can you help me with the ksh part? ... The problem is ...such redirection is not achieved due to some flaw ...
    (SuSE)
  • Re: VT100 input
    ... In order to stop the tty driver doing the echo you need to tell ... ksh here but coincidentally it is in fact ... If you use printf, then you need to remove the "\c". ...
    (comp.unix.shell)
  • Re: function definition syntax
    ... >> echo hello world ... as well as portable to Bourne shell. ... we had a built in trace-debugger functionality in our ksh ... In POSIX notation, you don't have that. ...
    (comp.unix.shell)