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
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