加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash中shell和环境变量的区别

发布时间:2020-12-15 19:08:12 所属栏目:安全 来源:网络整理
导读: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 ins
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

每次更改当前目录时都会发生变化。

对于大多数实际的任务,通过向?/ .bashrc文件添加导出VARIABLE_NAME = VALUE来设置环境值。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读