In the shell, if you need to switch users, and then run some commands as a specified user,
For example, you need to write a line of "Oracle_base=/oracle/app" to a. bash_profile file with an ORACLE user.
You can use the following statement
Su-oracle <<!
echo "Oracle_base=/oracle/app" >> bash_profile
Exit
!
About Su and Su-the difference between
Switching users can be implemented using SU Tom or Su-tom, but there is a difference
Su just switches identities, but the shell environment is still the original user's shell
Su-is the user's shell environment with the switch
The environment variable for path is valid when the shell environment is switched
Give examples:
For example, the root user in the/root/directory, Su Tom,
Switch to Tom User, but the directory is still under/root/.
If you use Su-tom
You can find that the directory also switches to Tom User's home directory
This is also caused by a number of command errors: why not Found
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/