Re: manipulating PS1 in sh



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.

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?
.



Relevant Pages

  • Re: getting current directory
    ... Not if /bin/sh is a symlink to zsh (in which case zsh emulates ... /usr/xpg4 in turn certainly is a Solaris specific path. ... >> To work around a bug in most kshs. ... But "command" itself happens to fork and exec a command, ...
    (comp.unix.shell)
  • Re: Ksh output garbled/out-of-sync
    ... I am able to reproduce the problem on several Solaris 5.8 systems now. ... Good Ksh: ... SunOS 5.8 Generic Patch November 2001 ...
    (comp.unix.shell)
  • Re: Can not login Solaris 10 with root via PuTTY.
    ... to set up your server and/or teach you Solaris sysadmin. ... Is Unix administration/programming so hard a work? ... It is the shell that determins the name of the profile file, ... I use ksh on HP-UX and can find two .profile, ...
    (comp.unix.solaris)
  • Re: negate if condition
    ... Solaris 2.3 on sparc. ... The ksh understands neither! ... Can you find out what version letter of ksh88 it is? ... The scripts have used '-a' since before my time in the company, ...
    (comp.unix.shell)
  • Re: negate if condition
    ... Solaris 2.3 on sparc. ... The ksh understands neither! ... it's a ksh88g. ...
    (comp.unix.shell)