Alan wrote: > I have had some trouble for a long time with exporting some environmental > variables from my .bash_profile or the .bashrc > > Even if I manually execute those files, the variables still are not set. I > have a echo 'path set' in files and I do see that when I do a: > > user@boxname:~$ ./.bashrc > path set > > > Only way I can get them to set is to put them into the default: > > /etc/profile.d > > What did I mess up way back when to prevent those files from working > properly? > > uname -a > Linux boxname 2.6.16.38LFS6.22 #6 Fri Mar 16 23:46:27 PDT 2012 i686 > pentium3 i386 GNU/Linux
You need to read the man page for bash to understand when /etc/profile, /etc/bashrc, ~/.bash_profile, and ~/.bashrc are called. Sometimes you call bashrc from ~/.bash_profile, but it depends on the contents. See the part of the man page called INVOCATION. To get an environment variable set, from a script you need to source that script, not execute it. Executing just sets a variable in a subshell and then exits, discarding the variable just set. A subshell *never* sets a variable in the parent environment. Logging in via ssh (interactive, login shell) is different from logging in from a display manager like kdm or xdm (interactive, non-login shell). To see what is being called, make the first line in each script write out the name of the file. For example, in /etc/profile, add: echo /etc/profile and so forth. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page