Differences between set, env, and export and setenvexport
Set: display the current shell variables, including the current user Variables
Env: Display User Variables
Export: displays the shell variables currently exported as user variables.
For example:
Root @ kali :~ # Aaa = bbb: Set a variable. The variable set at this time is a shell variable.
Root @ kali :~ # Echo $ aaa display the variable you just set
Bbb
Root @ kali :~ # Set | grep aaa display and search for the current shell variable, find the aaa variable you just set
Aaa = bbb
Root @ kali :~ # Env | grep aaa: displays and searches for the variables of the currently logged-on user. aaa is a shell variable and cannot be searched.
Root @ kali :~ # Export aaa export the shell variable aaa to the user variable
Root @ kali :~ # Env | grep aaa: Search for user variables to search for aaa.
Aaa = bbb
Root @ kali :~ #
Each shell has its own unique variables, which are different from user variables. The current user variables have nothing to do with what shell you use, no matter what shell you use. Such as HOME and SHELL, but shell also has its own variables. Different shells are different, such as BASH_ARGC and BASH. These variables are only displayed in set, is unique to bash. When an export parameter is not added, it shows which variables are exported as user variables, because a shell variable can be changed to a user variable through export "export.
Run the unset command to clear environment variables. You can use unset to clear all variables set by set env export.
In addition, the shell (bash here) initialization process is as follows:
1. bash check whether the file/etc/profile exists
2. If yes, bash will read the file. Otherwise, skip
3. bash check whether the file. bash_profile in the main directory exists.
4. If the file exists, bash reads the file. Otherwise, skip
5. bash check whether. bash_login in the main directory exists.
6. If the file exists, bash reads the file. Otherwise, skip
7. bash check whether the file. profile in the main directory exists
8. If the file exists, bash will read the file. Otherwise, it will be skipped.
After these steps are completed, a prompt is displayed. The ksh default prompt is $.
Reference
Http://www.opsers.org/base/set-env-and-export-the-difference-between-the-three-command.html
Http://blog.csdn.net/longxibendi/article/details/6125075
Http://www.linuxeden.com/html/sysadmin/20080424/56879.html
In linux, the set, export, and env commands work the same way when setting shell variables?
Env is the display variable.
Set and export are set variables.
Set for csh Environment
Export for bash Environment
Format: set DISPLAY 192.168.1.1: 0
Export DISPLAY = 192.168.1.1: 0
The differences between env, set, and profile in unix
I just made soy sauce.