To store the output of a command as a variable in sh/ksh/bash, you can do either
var=$(command)
or
var=`command`
"What's the difference if any between the two methods?"
Make attention to this behaviour:
A="A_VARIABLE" echo "$(echo "\$A")" echo "`echo "\$A"`"
You will get these results:
$A A_VARIABLE