LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 06-18-2009, 12:51 PM   #1
art1fex
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
Environment variables


I would like to know where $HOME(or $TERM, or $COLORTERM..) variable, for example, is originally set up.
 
Old 06-18-2009, 01:02 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Check /etc/profile.
 
Old 06-18-2009, 01:10 PM   #3
art1fex
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colucix View Post
Check /etc/profile.
Thank you for reply.

I'm using Ubuntu (jaunty). I've read about env vars here https://help.ubuntu.com/community/EnvironmentVariables

Of course I've checked all the stuff like /etc/profile or /root/.porfile or /etc/environment or /user/.profile..
I tried to find definition of this variables in the whole filesystem...no result

It would be great if anyone could help me.
 
Old 06-18-2009, 01:42 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,090

Rep: Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474
there is the /etc/bashrc and ~/.bashrc , ~/.bash_profile (/home/UserName/.bash_profile )

~/.bash_profile is where i set things up
-- this is part of my Cent5.3 file
Code:
LD_LIBRARY_PATH=/usr/lib:/usr/opt/CentOS/lib
LIBDIR=/usr/lib:/usr/opt/lib/CentOS
LD_RUN_PATH=/usr/opt/CentOS/lib:/usr/lib
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/opt/CentOS/lib/pkgconfig
export PATH LD_LIBRARY_PATH LD_RUN_PATH LIBDIR PKG_CONFIG_PATH
 
Old 06-18-2009, 02:21 PM   #5
JDska55
LQ Newbie
 
Registered: Jun 2009
Location: Iowa City, IA
Distribution: SuSE 11, ubuntu Hardy
Posts: 28

Rep: Reputation: 15
I'm with John VV here.
Regardless of what is setting the variables, if you put a .bash_profile file in your home directory, you can set them to whatever you need and then will override/change any previous setting.
 
Old 06-18-2009, 05:36 PM   #6
art1fex
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for answers. Good forum!

There is another question: Could anybody provide information about scope of environment variables. For, example, how does processes get information about environment variables and when are they not able to see them?
Especially I'm interested in proc connected with web services(tomcat6, axis2...).
 
Old 06-18-2009, 05:47 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
Env variables are only visible to the shell they were defined in, unless the keyword 'export' is used as in

var1=fred
export $var1

See your .bashrc, .bash_profile in your home dir for examples eg $PATH.
In that case, they are then avail to all sub-shells generated from that point, inc sub-sub-shells, sub-sub-sub-shells etc.
Note you CANNOT export env var values UP the chain.
They are also not visible in other shells started by yourself if the new shell is not a descendent of the defining shell.

http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
  


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 variables nasht Linux - General 3 08-11-2005 02:12 PM
environment variables naren Linux - Software 1 12-15-2004 06:44 AM
when to use environment variables? mark_2811 Programming 2 02-23-2004 06:09 PM
environment variables moeminhtun Linux - General 4 01-15-2003 09:50 AM
environment variables aethereal Linux - Newbie 7 12-19-2001 09:34 AM


All times are GMT -5. The time now is 05:41 AM.

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