Sub-shell and export commands-general Linux technology-Linux programming and kernel information. The following is a detailed description. After logging on to the system, the system starts a User shell. In this shell, you can use shell commands or declare variables, or create and run shell scripts. When you run the shell script program, the system creates a sub-shell. At this point, there will be two shells in the system, one is the shell started by the system at login, and the other is the shell created by the system for running the script program. When a script program runs successfully, its script shell is terminated and can be returned to the shell before the script is executed. In this sense, you can have many shells, each of which is derived from a shell (called the parent shell.
The variables defined in the sub-shell are valid only in the sub-shell. If a variable is defined in a shell script program, when the script is running, the defined variable is only a local variable in the script program, and other shells cannot reference it, to change the value of a variable in other shells, you can use the export command to output the Defined variables. The export command enables the system to define a copy of this variable when creating a new shell. This process is called variable output.
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