Understanding PATH variable setting?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Understanding PATH variable setting?
# 1  
Old 12-12-2012
Understanding PATH variable setting?

I do know how we set the PATH variable-

Code:
 
export PATH=$JAVA_HOME/bin:$PATH

I'm trying to understand why we have written
Code:
:$PATH

in the end above statement. What is it's meaning?
# 2  
Old 12-12-2012
It means append new path $JAVA_HOME/bin to existing PATH variable value. It you do not specify :$PATH, the PATH variable value will be entirely overwritten with the new value, but in this case we are retaining previous value and appending to it.

For further reference click here

Last edited by Yoda; 12-12-2012 at 04:37 PM..
# 3  
Old 12-12-2012
cool. thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Problem setting path to external hard drive as a variable

Hello all, I am EXTREMELY new to using bash and I have a bit of a problem: I'm trying to set up a shell script that can 1.) take one of several giant files off of an external hard drive 2.) use it as input for scripts on my laptop's hard drive ... (3 Replies)
Discussion started by: machine_spirit
3 Replies

2. Shell Programming and Scripting

Understanding $PATH better

Dear all, I have a script which triggers a C program in it after initialising parameters. Below is the sample #! /bin/sh . /my_data/environment HOME=/home/execs/testing/ cd $HOME compare $1 $2 X exit $? (10 Replies)
Discussion started by: PikK45
10 Replies

3. UNIX for Dummies Questions & Answers

Help me setting up dns and understanding it.

Hi I need to set up a dns server for Oracle 11g rac setup. I got some files (copied from friend) named.conf and related files in /var/named , i was told that this would work fine. But i am getting some issues. I am attaching the files here. The problem is dig... (1 Reply)
Discussion started by: ankurk
1 Replies

4. Shell Programming and Scripting

Setting path variable with a space.

Hi I am using MKS Toolkit c shell. I am trying to set a path variable something like c:/Program Files/blah/blah so set path=(c:/Program Files/blah/blah) this, however, does not work as it splits this thing up into 'c:/Program' and 'Files/blah/blah'. Does anyone have any ideas on... (9 Replies)
Discussion started by: vas28r13
9 Replies

5. Shell Programming and Scripting

Appending a path in user's PATH variable

Hello Folks, I want to append a path in user's PATH variable which should be available in current session. Background Numerous persons will run a utility. Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies

6. Shell Programming and Scripting

one liner to extract path from PATH variable

Hi, Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable? for eg: suppose the PATH is being set as follows PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4 ... (2 Replies)
Discussion started by: royalibrahim
2 Replies

7. Shell Programming and Scripting

Error in setting PATH variable in bash shell

Hi, I am new to shell scripting.I tried adding an entry to the path variable like below export PATH=$PATH:/opt/xxx/bin But am getting an error invalid identifier /opt/xxx/bin Can someone tell me the error above and correct me . Thanks and Regards, Padmini (2 Replies)
Discussion started by: padmisri
2 Replies

8. Shell Programming and Scripting

Setting path

Hi all, I have a java command in a shell script. When i m executing the command from the prompt its working fine. But when i paste the same command in a shell script and execute the shell script it says path not found. Please help. (5 Replies)
Discussion started by: radhika03
5 Replies

9. UNIX for Dummies Questions & Answers

Help on setting path variable

Hi there, I need help on setting the path variable. How can I set the path variable with Bourne Shell. My scripts goes like this, but did not work. #!/bin/sh PATH=/usr/bin:/usr/ucb:/etc:/export/home/zchen/home export PATH Thanks, Z (4 Replies)
Discussion started by: randomcz
4 Replies
Login or Register to Ask a Question