This is fairly easy to do compared to the amount of trouble i had to go through to find it. All you have to do is to surround the shell command with the “`” character (this is not the single quote character) and assign the whole string to the variable name.
$ echo $n
pom.xml src target
Its as simple as that. Have fun.