Click to See Complete Forum and Search --> : source /etc/profile everytime in normal user?


Sridhar Guntur
10-18-2002, 05:04 PM
i have java's bin in /usr/java/j2sdk1.4.1.so i su - and put export PATH=$PATH:/usr/java/j2sdk1.4.1/bin
in etc/profile .and i did source /etc/profile once.and i could access java and javac commands in root account every time without doing source /etc/profile, but when i go to normal user accout, i have to do source /etc/profile every time to access java and javac . is there a way that i can avoid doing source /etc/profile everytime while in normal user account?

i have searched on net but they ask to do source or . (dot) /etc/profile but dont say if i have to do everytime in normal user mode.

thank you.

bwkaz
10-18-2002, 06:37 PM
profile files (which are either ~/.bash_profile or ~/.profile) are only run when you log in the first time, like from the login program that init starts. These files usually source /etc/profile themselves if it exists. When you use su, or even su -, then bash runs your ~/.bashrc file instead of your ~/.bash_profile file. So if you add the same export PATH=...... command to /etc/bashrc (which usually gets executed by ~/.bashrc if it exists), you should have access to the Java programs no matter how your shell starts up.