What does it mean in shell when we put a command inside dollar sign and parentheses: $(command)

前端 未结 2 886
忘了有多久
忘了有多久 2020-11-27 12:57

I just want to understand following line of code in shell. It is used to get the current working directory. I am aware that $(variable) name return the value in

2条回答
  •  醉酒成梦
    2020-11-27 13:37

    Usage of the $ like ${HOME} gives the value of HOME. Usage of the $ like $(echo foo) means run whatever is inside the parentheses in a subshell and return that as the value. In my example, you would get foo since echo will write foo to standard out

提交回复
热议问题