Solved

Why? java path not coming before /usr/bin

Posted on 2014-02-11
4
254 Views
Last Modified: 2014-02-21
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
Comment
Question by:bcarlis
  • 2
  • 2
4 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39851626
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39854032
Yes you did but I thought Sandys was same and it returned the email msg so I thought it did it ???
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 150 total points
ID: 39854228
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
 
LVL 2

Author Closing Comment

by:bcarlis
ID: 39877430
Sorry got busy with the "Next" thing :)
Thank you so much for your help.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now