UNIX, get environment variable

前端 未结 7 773
滥情空心
滥情空心 2020-12-30 18:41

I have a ridiculous question due to a ridiculous problem.

Normally if I want to get the contents of an environment variable in UNIX shell, I can do

         


        
相关标签:
7条回答
  • 2020-12-30 19:31

    Using ${!VAR_NAME} should be what you are looking for

    > FOO=BAR123
    > VAR_NAME=FOO
    > echo ${VAR_NAME}
    FOO
    > echo ${!VAR_NAME}
    BAR123
    
    0 讨论(0)
提交回复
热议问题