Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-17-2007, 08:07 AM   #1
LQ Newbie
Registered: Feb 2007
Location: Bangalore
Distribution: Fedora
Posts: 18

Rep: Reputation: 0
Question Environment variable

Hello friends,,

How can I set the environment variable permanently..
mean to say that I have an application ,which i will save in /root/abc.

Now I need the environmental XYZ to be set to the path where the application is.. ie.,/root/abc

Now I set the environmental variable
export XYZ=/root/abc

when i close the application and run once again or switch of the system the environmental variable would nolonger exist why???

and the application ask me to set it again when i re-run the program.

so i need some way to set the environment variable permanently.. like the system environmental variables
Old 05-17-2007, 08:20 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
The /root directory is only accessible by root. You shouldn't put applications there. Also, roots home directory shouldn't be in the path. Consider another place such as /usr/local/sbin/ or /usr/sbin/ if it is an administrative program or /usr/local/bin or /usr/bin/ if a normal user runs it.

These are standard paths and should already be in your path. If not, add the line "PATH=$PATH:/usr/local/bin/" to your ~/.profile file. (assuming you are running the bash shell).

Use your systems config program to set the hostname. You will also need to log out of KDE after changing the hostname. It will probably change the contents of /etc/HOSTNAME.

The value of HISTSIZE would probably be best set in ~/.bashrc. Check both your ~/.profile and ~/.bashrc files and see if they are already set in one of them.

Generally, for things that get set once, when you login, use ~/.profile. Especially for changing your PATH, because .bashrc is sourced every time you start a new shell.

Last edited by jschiwal; 05-17-2007 at 08:24 AM.


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
Environment variable.. manomohan Programming 1 02-27-2007 12:27 AM
environment variable gamor Linux - Newbie 4 04-30-2005 06:28 PM
Environment Variable salmanucit Linux - Software 2 07-21-2004 03:27 AM
environment variable mimi Linux - Newbie 1 04-10-2002 09:29 AM
environment variable mimi Linux - General 2 04-10-2002 08:45 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:13 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration