assing a linux xommant to a variab;e

C++
variable_name=$(command)
OR
FILES=`sudo find . -type f -print | wc -l`
Source

Also in C++: