Solved

Why? java path not coming before /usr/bin

Posted on 2014-02-11
4
257 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with my python script 6 163
Need a python script 5 96
bash script to resolve all hostnames in a list 8 49
Exchange PowerShell Do While not working as expected 1 55
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…
Utilizing an array to gracefully append to a list of EmailAddresses
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…

821 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