Execute command containing quotes from shell variable [duplicate]

Arrays are useful to keep your parameters whole:

command=(su aUser -s /bin/bash -c 'echo A')

and invoke it exactly like this:

"${command[@]}"

Leave a Comment