编程知识 cdmana.com

Linux environment variable operation command

Linux Environment variable operation command

Environment variable common command

View environment variables

grammar

echo $ Environment variable name 

Example : see PATH

echo $PATH

export

export Command to set or display environment variables .
stay shell When the program is executed in ,shell It provides a set of environment variables .export Can add , Modify or delete environment variables , For subsequent procedures .export The environment variable created by the command only applies to this login operation .

Add a new global environment variable

export  Variable name = A variable's value 

Example :

export TEST=1

 Insert picture description here
every last bash Script files (*.sh file ) Each has its own independent running process .
export The environment variable added by the command is applied to all users in the current login bash Script .
If you omit “export”, direct “ Variable name = A variable's value ” The grammar of , That's just a local environment variable assignment , This variable only works on the bash Script .

版权声明
本文为[gugugutime]所创,转载请带上原文链接,感谢
https://cdmana.com/2022/134/202205141324555747.html

Scroll to Top