Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 05-18-2006, 03:45 AM   #1
LQ Newbie
Registered: Apr 2006
Distribution: Kubuntu Dapper
Posts: 14

Rep: Reputation: 0
add path and variables bash

Im trying to install Apache Ant and it says i have do type this in Konsole:
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/local/jdk-1.2.2
export PATH=${PATH}:${ANT_HOME}/bin

Once i do this i can type: "ant" and the program will work. However when i close Konsole and open it up again it cant find command "ant". It appears what i have typed wasnt saved. I tried editing the .bash_profile but am unsure of the format that the above commands need to be written. Can someone tell me how to save added path and variables permanently into bash?
Old 05-18-2006, 04:05 AM   #2
Registered: Aug 2003
Location: Montpellier, France, Europe, World, Solar System
Distribution: Debian Sarge, Fedora core 5 (i386 and x86_64)
Posts: 262

Rep: Reputation: 30
Put those lines into your .bashrc file in your home. They will then be executed everytime your start a new bash shell.
Old 05-18-2006, 04:34 AM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
Your ~/.bash_login or ~/.profile scripts would be a better place.
The line "export PATH=${PATH}:${ANT_HOME}/bin" would add ${ANT_HOME}/bin to your path whenever you started a new subshell. The ~/.bash_login is sourced once when you login.

See the "info bash" section 6.2 (bash startup files).
Old 05-18-2006, 05:11 AM   #4
Registered: Mar 2006
Posts: 96

Rep: Reputation: 16
-for all users: (interactive login)

Others distros too use scripts on folder: /etc/profile.d (Red Hat/Fedora)
I don't know Mandriva.

-for all users: (non-interactive login)
/etc/bashrc (or /etc/bash.bashrc)

-for specific user on login: (interactive login)
~/.bash_login (others names: .bash_profile, .profile)

-for specific user on logout: (interactive login)

-for specifc user on login: (non-interactive login)

Good luck!


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
How to set PATH variables vivekr Linux - Newbie 10 06-04-2012 07:35 PM
Extra path variables? mjm461 Linux - General 1 09-15-2005 02:21 PM
Setting PATH and other variables durrantj Ubuntu 2 08-25-2005 07:44 PM
adding $PATH variables karupt Linux - Newbie 5 03-07-2004 06:27 PM
can save new $PATH variables slinkysteve Linux - Newbie 1 10-29-2003 10:30 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:16 PM.

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