Operating System - HP-UX
1837199 Members
2702 Online
110115 Solutions
New Discussion

exec $SHELL cause me to lose $HOST in PS1 ??

 
SOLVED
Go to solution
Sammy_2
Super Advisor

exec $SHELL cause me to lose $HOST in PS1 ??


in user's .profile
=====================
HOST=`hostname|cut -c1-10`
USER=`whoami`
ORACLE_SID=esqab
export PS1='$HOST:$USER:$ORACLE_SID:$PWD>
============================
After login see the following PS1 prompt:
ojrdhes4:escript:esqab:/users/escript>

================================


ojrdhes4:escript:esqab:/users/escript> echo $SHELL
/usr/bin/ksh

Why do I lost my $HOST and $USER ?(see below)
when I run this exec command.

ojrdhes4:escript:esqab:/users/escript> exec $SHELL
::esqab:/users/escript>
(the above line is the output of exec $SHELL with 2 double colons)




Thanks in advance.

good judgement comes from experience and experience comes from bad judgement.
2 REPLIES 2
Laurent Menase
Honored Contributor
Solution

Re: exec $SHELL cause me to lose $HOST in PS1 ??

you can either do
export HOST
export USER
or
PS1="$HOST:$USER"':$ORACLE_SID:$PWD'

So HOSTS and USER are evaluated before the affectation.
Sammy_2
Super Advisor

Re: exec $SHELL cause me to lose $HOST in PS1 ??

Laurent,
Bingo. That's what i needed. I went with "" suggestions.
Thanks bunch.
good judgement comes from experience and experience comes from bad judgement.