Accessing system wide environment variables inside a bash script

后端 未结 1 1662
余生分开走
余生分开走 2021-01-21 21:13

I\'ve added a system wide environment variable in /etc/environment. I want to access this variable in a bash script. Is there any way to access it?

相关标签:
1条回答
  • 2021-01-21 22:07

    Assuming that PATH is an environmental variable, also in /etc/environment, I can access path in a script like this:

    #!/bin/sh
    
    
    echo $PATH
    

    So what's wrong with your variable?

    0 讨论(0)
提交回复
热议问题