课程: Linux CentOS 7: Shells and Processes

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Variables and shell environment

Variables and shell environment

- [Instructor] There are two types of variables accessible in a shell session. Environmental variables are variables that are defined for the current shell and are inherited by any child processes or child shells. Shell variables are variables that are contained exclusively within the shell in which they were defined. They are often used to keep track of data like the current working directory. To see the environmental variables in a terminal, type in printenv and hit Enter. If you want to get the value of an individual variable, you can specify it. Type in printenv, and for instance type in capital SHELL and hit Enter. Another way is to use the echo command to print the value by typing in echo $SHELL and hit Enter. To see the shell variables we use the set command. Type in set and hit Enter. By default the set command shows shell functions as well as variables, which can be quite long. To change the behavior of…

内容