LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   set and env show values of what file(s)? (https://www.linuxquestions.org/questions/linux-newbie-8/set-and-env-show-values-of-what-file-s-437032/)

xcore_on 04-20-2006 04:14 AM

set and env show values of what file(s)?
 
hello all,

the commands "set" and "env" get and show values of what files?


I have read than:

set get and show values of:
/etc/bashrc (or /etc/bash.bashrc)

env get and show values of:
/etc/profile

But this not is very true in my distro's:
-Debian 3.1r1 (kernel 2.4.27-2-386)
-Fedora Core 5 (kernel 2.6.15-1.2054_FC5)

have much more informations show in this commands.
so, "set" and "env" get and show values of what files?

thanks in advance!!!

halturata 04-20-2006 08:36 AM

The files you mention (/etc/bashrc and /etc/profile) are read at boot-time and somewher in them the env variables are exported. Further in /etc/rc.d/rc/sysinit the "foundations" of PATH are build with :
Code:

# Set the path
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

... and many more ...

somewhere in the beginning of the file. Perhaps that is the part you are looking for.
In addition some of the scritps in /etc/rc.d/rcX.d may start services which export their own env variables.

P.S. The above paths are taken from Red hat disto, I don't know if they are the same for Fedora and Debian.

chrism01 04-20-2006 11:48 PM

Actually, they show the current environment variables (hence 'env'). Scripts/progs can add to the env using alis cmd eg
alias vi=vim
use export cmd to ensure definitions are carried down into sub-shells eg
export vi

xcore_on 05-30-2006 04:43 PM

so, env show variables in /etc/profile and set show variables in /etc/bashrc!

this is true?

haertig 05-30-2006 05:16 PM

Quote:

Originally Posted by xcore_on
so, env show variables in /etc/profile and set show variables in /etc/bashrc!

this is true?

No. env shows your current environment. Things can get into your environment in different ways. /etc/profile is one way to set them. /etc/bashrc is another way. You can set them manually.

The closest "file" you can come to that contains your enviroment, is /proc/<pid>/environ, where "<pid>" is replaced by the actual process_id of your current shell.


All times are GMT -5. The time now is 04:39 PM.