I'm quite new to Linux. Debian Wheezy is now running on my Laptop (64 bits).I recently installed Oracle 11g R2 database for evaluation purpose, and defined environment variables (such as ORACLE_SID) through a script /etc/profile.d/oracle.sh. This works fine, but for the oracle user. I change user by su - oracle.The value of ORACLE_SID is different from the one specified in the /etc/profile.d/oracle.sh file.As the oracle user has no file (such as .bash_profile, .profile etc.) in its home directory, where can this value come from?What is the overloading sequence of environment variables?
Any other way to define an environment variable?
environment variables
What ever set's the environment variable last wins. So it doesn't really matter, I would just set the variable in the oracle user's $HOME/.bashrc file towards the bottom.The file $HOME/.bashrc is the key file which sources files such as /etc/bashrc and the files under /etc/profile.d/*.sh for example. So I would just set ORACLE_SID=whatever in $HOME/.bashrc. Debugging TipIf you want to see what's going on you can debug your login like so:su - oracle -c env SHELLOPTS=xtrace bashWith the above command you can follow along as the different files are sourced by bash:......++ for i in '/etc/profile.d/*.sh'++ '[' -r /etc/profile.d/less.sh ']'++ '[' '[\u@\h \W]\$ ' ']'++ . /etc/profile.d/less.sh+++ '[' -x /usr/bin/lesspipe.sh ']'+++ export 'LESSOPEN=||/usr/bin/lesspipe.sh %s'+++ LESSOPEN='||/usr/bin/lesspipe.sh %s'++ for i in '/etc/profile.d/*.sh'++ '[' -r /etc/profile.d/PackageKit.sh ']'++ '[' '[\u@\h \W]\$ ' ']'++ . /etc/profile.d/PackageKit.sh++ for i in '/etc/profile.d/*.sh'++ '[' -r /etc/profile.d/qt.sh ']'++ '[' '[\u@\h \W]\$ ' ']'++ . /etc/profile.d/qt.sh+++ '[' -z /usr/lib64/qt-3.3 ']'++ for i in '/etc/profile.d/*.sh'++ '[' -r /etc/profile.d/udisks-bash-completion.sh ']'++ '[' '[\u@\h \W]\$ ' ']'++ . /etc/profile.d/udisks-bash-completion.sh+++ '[' -z '4.1.7(1)-release' ']'+++ complete -o filenames -F __udisks udisks++ for i in '/etc/profile.d/*.sh'++ '[' -r /etc/profile.d/vim.sh ']'++ '[' '[\u@\h \W]\$ ' ']'++ . /etc/profile.d/vim.sh+++ '[' -n '4.1.7(1)-release' -o -n '' -o -n '' ']'+++ '[' -x //usr/bin/id ']'++++ //usr/bin/id -u+++ '[' 0 -le 200 ']'+++ return++ for i in '/etc/profile.d/*.sh'++ '[' -r /etc/profile.d/which2.sh ']'......