How to execute a bash command stored as a string with quotes and asterisk [duplicate]
Have you tried: eval $cmd For the follow-on question of how to escape * since it has special meaning when it’s naked or in double quoted strings: use single quotes. MYSQL=’mysql AMORE -u username -ppassword -h localhost -e’ QUERY=”SELECT “‘*'” FROM amoreconfig” ;# <– “double”‘single'”double” eval $MYSQL “‘$QUERY'” Bonus: It also reads nice: eval mysql … Read more