You are not logged in.

#1 2009-09-01 09:28:26

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Where are environment variables stored?

Hi,

A not so old textbook points to .bashrc, but it obviously isn't the case with Arch. env command shows a lot of variables; there has to be a file somewhere, hasn't it?

Offline

#2 2009-09-01 09:30:32

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Where are environment variables stored?

/etc/profile is systemwide, ~/.bashrc is user specific.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#3 2009-09-01 09:52:04

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: Where are environment variables stored?

.bashrc is all but empty; even /etc/profile is nowhere near as populated as env output...

Offline

#4 2009-09-01 10:00:37

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: Where are environment variables stored?

Read /etc/profile. It sources /etc/profile.$shell as well as all scripts in /etc/profile.d/ that have the execute bit set.

Offline

#5 2009-09-01 10:03:55

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: Where are environment variables stored?

Various scripts/programs can also export enviroment variables at their runtime...have you actually looked at the output of env ?


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#6 2009-09-01 10:07:23

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: Where are environment variables stored?

moljac024 wrote:

have you actually looked at the output of env ?

Yes, I have big_smile . I'm just trying to trace it to source...

Offline

#7 2009-09-01 10:26:01

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: Where are environment variables stored?

/etc/profile/ loads many things in /etc/profile.d, which also might set environment variables.

Offline

#8 2009-09-01 11:22:20

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Where are environment variables stored?

bash and login set things like HOME, USER, PWD...

[edit]

Also interesting: /proc/PID/environ (it uses 0 separators, so: cat environ | tr '\0' '\n')

Last edited by Procyon (2009-09-01 11:34:26)

Offline

Board footer

Powered by FluxBB