bash variable in string

C++
foo="Hello"
foo="${foo} World"
echo "${foo}"
> Hello World${!var}	#Just use to use reference value inside another variable ;)VAR1="Hello,"
VAR2=" World"
VAR3="$VAR1$VAR2"
echo "$VAR3"
domain='http://www.whitehouse.gov'
path='/some/path'
base_url="$domain$path"#Just use following structure to store output of command into a variable:
var=$(command)
#For example:
var=$(echo 'hi')	#store hi into var
var=$(ls)	#store list of files into var
Source

Also in C++: