Differences between the set, ENV, and export commands
(11:24:46)
Reprinted
Set: display the current shell variable, including the current user's variable env display the current user's variable export display the shell variable currently exported to the user variable each shell has its own unique variable (SET) the displayed variables are different from the 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, however, shell variables are different from shell variables, such as bash_argc and bash. These variables are only displayed in set and are unique to bash. When export does not contain parameters, display which variables are exported as user variables, because a shell variable can be changed to a user variable through export "Export.
Set is used to display local variables.
Env is used to display environment variables.
Export is used to display and set environment variables.
Shell variables include two types of variables 1. shell private variables: variables defined by the value assignment statement can be defined using the following method: Shell variable a1 = "1234" delcare a2 = "2345" 2. user's environment variables: Shell private variables exported through the Export syntax, you can use the following method to export the user environment variable a1 = "1234" Export A1 # first define and then export the user environment variable exported from export a3 = "34". You can see env in all the shells. displays the user's environment variables; set displays the private variables defined by the current shell, including the user's environment variables, sorted by the variable name; export displays the shell variables currently exported as user variables, and display the attributes of the variables (read-only or not), sorted by the variable name; declare is, like set, displays the variables defined by the current shell, including the user's environment variables;