shell和环境变量有什么区别?
&安培;他们每个人的存储位置是什么?
&安培;他们每个人的存储位置是什么?
引用
this source,
Standard UNIX variables are split into
two categories,environment variables
and shell variables. In broad terms,
shell variables apply only to the
current instance of the shell and are
used to set short-term working
conditions; environment variables have
a farther reaching significance,and
those set at login are valid for the
duration of the session. By
convention,environment variables have
UPPER CASE and shell variables have
lower case names.
要列出所有环境变量,请使用printenv并列出所有shell变量,使用set。
您会注意到,环境变量存储更多的永久性值,例如:
HOME=/home/adam
哪些更改很少,而shell变量存储本地,临时,特定于shell的值,例如:
PWD=/tmp
每次更改当前目录时都会发生变化。