Difference between set env Export

Source: Internet
Author: User
Differences between the set, ENV, and export commands

(11:24:46)

Reprinted
Tags:

It
 
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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.