Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

重新理解环境变量 #7

Open
diebbCN opened this issue Jul 17, 2024 · 0 comments
Open

重新理解环境变量 #7

diebbCN opened this issue Jul 17, 2024 · 0 comments
Labels

Comments

@diebbCN
Copy link
Owner

diebbCN commented Jul 17, 2024

environment一词在维基百科中的解释是Environment means what surrounds us. It may be living or non-living things. It includes physical, chemical and other natural forces.
环境是无时无刻围绕着我们的东西,就好比空气,你走到哪都有,因此你在哪都能呼吸到空气。与linux中的“环境”类比,环境变量就像我们周围的空气,在系统任意目录下,都能执行,都能呼吸这个空气。比如,你可以在任意位置使用 ls 命令查看当前目录下的文件。等等许多命令之所以能在任意地方执行,就是因为他们是环境变量的一份子,“是空气的组成成分之一”。
可以想象环境变量就是围绕在人身边的精灵,你走到哪他跟到哪。你可以随时命令这些精灵干事。

linux中如何设置环境变量?

linux中使用 PATH这个变量作为环境的载体,定义该环境中的组成元素(目录),元素间用冒号分隔。例子:将/new/path/bin添加为环境变量PATH=${PATH}:/new/path/bin
其中啊,${PATH}就是调用已存在的环境变量,在这里做了个字符串拼接成新的环境变量列表。

@diebbCN diebbCN added the Linux label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant