Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

Why? java path not coming before /usr/bin

ok, how come the java path is not coming before /usr/bin

.profile
PATH=/usr/java71/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin.

export PATH

if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
then echo "$MAILMSG"        # operation, the Shell checks
fi                          # periodically.

# User specific aliases and functions
export AS_JAVA=/usr/java71
export JAVA_HOME=/usr/java71
export JAVA_BINDIR="${JAVA_HOME}/bin"
echo $PATH | /bin/grep -q -v "${JAVA_BINDIR}"
if [ $? -eq 0 ]; then export PATH="${JAVA_BINDIR}:${PATH}"; fi
echo $PATH
export GLASSFISH_PARENT=/u01/oracle/glassfish
export GLASSFISH_HOME=/u01/oracle/glassfish/glassfish
echo $PATH | /bin/grep -q -v "${GLASSFISH_HOME}/bin"
if [ $? -eq 0 ]; then export PATH="${PATH}:${GLASSFISH_HOME}/bin"; fi
echo $PATH

Open in new window


Then I run the following and it shows /usr/java71/bin is in front of /usr/bin/
but then
$ ./.profile
[YOU HAVE NEW MAIL]
/usr/java71/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/glassfsh/bin:/usr/bin/X11:/sbin.
/usr/java71/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/glassfsh/bin:/usr/bin/X11:/sbin.:/u01/oracle/glassfish/glassfish/bin
$ echo $PATH
/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/glassfsh/bin:/usr/bin/X11:/sbin:/usr/java71/bin.:/u01/oracle/glassfish/glassfish/bin

Open in new window

0
BILL Carlisle
Asked:
BILL Carlisle
  • 2
  • 2
1 Solution
 
woolmilkporcCommented:
You must "source" the .profile, i.e. run it inside the current shell, like this

. ./.profile

dot space dot slash dot profile

Didn't I mention that in our previous thread?
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Yes you did but I thought Sandys was same and it returned the email msg so I thought it did it ???
0
 
woolmilkporcCommented:
Without the "dot space" in front the .profile script is executed in a subshell of the current shell.

Such a subshell can well execute commands or display messages which you can see on your terminal.

The only thing is that environment variables set in a subshell do not become known to the parent shell - you can set and work with these variables as long as you're in the subshell (the script). As soon as the subshell script exits all variables set there are lost (resp. return to the value they had before).
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Sorry got busy with the "Next" thing :)
Thank you so much for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now