How to assign the result of a command to a variable in shell?
In shell, you can use backticks “ or $() to assign the result of a command to a variable.
Using backticks “ to indicate:
variable=`command`
By using $() method:
variable=$(command)
For example, assigning the output of the “ls” command to the variable “files”:
files=`ls`
“Or”
files=$(ls)