web123456

Assign command results to variables in shell

Assign command results to variables in shell

Two methods are recommended to use the latter, which supports nesting. The following two reference links are very clear.

var=`command`

var=$(command)

refer to:

/questions/9449778/what-is-the-benefit-of-using-instead-of-backticks-in-shell-scripts

http://book./art/201411/