LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-17-2013, 01:11 AM   #1
AussieAndrew
LQ Newbie
 
Registered: Jul 2013
Posts: 8

Rep: Reputation: Disabled
How do you add a 'bin' directory to the PATH environment variable?


Hi Everyone,

This is my first question, so I apologise if it's an oldie!

I'm trying to configure and install OpenGTS software on a new CentOS server. I am loading Apache Ant at the moment and have an instruction that says the following:

"Make sure that the Ant installation 'bin' directory has been added to the PATH environment variable."

I have two problems with this.

First, I'm not sure if that means to change the PATH variable to point to the bin location or if you somehow have multiple locations in the PATH variable using an array or something.

Secondly, when I installed Ant, it didn't seem to create a 'bin' folder.

Can I please get some guidance on what to do?

Regards,
Andrew Walker
 
Old 07-17-2013, 01:17 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

you can modify your PATH on the command line with something like:
Code:
PATH="/path/to/ant/bin:$PATH"
That will add /path/to/ant/bin to your path for *that session only*. To have it set for every session you can add it to one of the files that is sourced when you log in. For example you could add the line to your ~/.profile file.

As to what the ant bin directory is (what I have called "/path/to/ant/bin" above), it will depend on how you installed ant. So, how did you install ant?

Cheers,

Evo2.
 
Old 07-17-2013, 01:38 AM   #3
AussieAndrew
LQ Newbie
 
Registered: Jul 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks for the quick reploy Evo2.

I installed ant using yum install ant.

I have located the 'bin' folder for ant under usr/bin rather than under the ant folder, so that's a good start. I am now trying to edit the .bash_profile so I can keep the PATH variable like this as the root user. I've found a forum that says I should do this:

export PATH="A"
export PATH="$PATH:B"
export PATH="$PATH:C"

Do you agree with that?

Cheers,
Andrew
 
Old 07-17-2013, 01:51 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,
Quote:
Originally Posted by AussieAndrew View Post
Thanks for the quick reploy Evo2.

I installed ant using yum install ant.

I have located the 'bin' folder for ant under usr/bin rather than under the ant folder,
Ok that's good. /usr/bin should already be in your PATH (/usr/bin is where most system executables live).

Quote:
I am now trying to edit the .bash_profile so I can keep the PATH variable like this as the root user. I've found a forum that says I should do this:

export PATH="A"
export PATH="$PATH:B"
export PATH="$PATH:C"

Do you agree with that?
That is basically correct. So after those three lines your path should be "A:B:C". Note however that you only need to "export" the variable once. So you can do something like
Code:
export FOO="a"
FOO="b:$FOO"
FOO="c:$FOO"
You can check the value of your path at any time with the echo command. Eg
Code:
echo $PATH
You can do this to confirm that /usr/bin is already there. You can also confirm that the ant bin dir is in you path by running:
Code:
which ant
Which will return the full path to the ant executable (should be "/usr/bin/ant"). All this means that you should not actually have to modify your PATH variable at all.

Cheers,

Evo2.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PATH environment variable rupeshkp728 Linux - Software 4 07-11-2012 11:01 PM
PATH environment variable Storken Linux - Newbie 7 12-23-2009 05:48 PM
[SOLVED] How to add an environment variable to the PATH? ggyyree Linux - Newbie 4 11-20-2009 12:49 PM
PATH environment variable moonz Red Hat 3 09-08-2005 04:10 PM
edit path environment variable to include current working directory alb1954 Linux - Newbie 8 07-11-2004 11:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration