LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 05-17-2007, 07:07 AM   #1
vedanu
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
PATH ,HOSTNAME ,HISTSIZE
 
Old 05-17-2007, 07:20 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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 07:24 AM.
 
  


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
Environment variable.. manomohan Programming 1 02-26-2007 11:27 PM
environment variable gamor Linux - Newbie 4 04-30-2005 05:28 PM
Environment Variable salmanucit Linux - Software 2 07-21-2004 02:27 AM
environment variable mimi Linux - Newbie 1 04-10-2002 08:29 AM
environment variable mimi Linux - General 2 04-10-2002 07:45 AM


All times are GMT -5. The time now is 08:42 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration