I have been trying to set variables for JAVA_HOME, etc., and couldn’t figure out why, when I entered “su johnsmith” (“johnsmith” being whatever the user’s name is) the user’s .bashrc wasn’t being picked up. It had two do with two things: first, using “su ” as opposed to “su – ” and, second, the difference in function between .bashrc and .profile. I found a helpful post from http://forums.fedoraforum.org/showthread.php?t=217954.

The .profile file is executed in a login shell and is where environment variables are set. .bashrc is where other stuff is kept. It is launched by a login. “su -” simulates a login, therefore launching the .profile, whereas “su” does not.

Advertisements