The login shell executes two special files,
One is: \etc\profile, this file is set by the system administrator, usually do some such as check whether there is mail, set the default file to create a mask, to some table to go everywhere variable assignment, already any administrator wants to execute the command every time the user logs on.
The 2nd automatically executed file is the. profile file in the host directory. When you get an account, the system administrator will give a default. profile file.
Look at what it's like now:
$cat $HOME/.profile
Path= "Bin:/usr/bin:usr/lbin:.:"
Export PATH
$
What you see here is a small. profile file, which simply sets the path and then exports it. You can modify your. profile file to include any commands that you want to execute every time you log on. Settings can place commands in their own. profile files, overwriting/etc/profile settings (usually environment variables).
Note that/etc/profiles and. Profile are executed by a login shell,
$./etc/profile
$. . Profile
$
This means that their changes to the environment will be preserved after the program is executed.
After you change the user with the SU command, you need to execute the user's. profile file. It's like doing an initialization.
Su-spsausr
. /db2/ldid111/sqllib/db2profile
About profile files