I'm trying to run a query from a bash script:
#!/bin/bash
query="\"show databases\""
command="mysql --defaults-file=/user/.my.cnf -e "
outputfile=" > query_result.txt"
command=$command$query$outputfile
$($command)
the result is this:
# ./query_test
mysql: unknown option '--print-defaults'
what I'm doing wrong?
The command:
mysql --defaults-file=/user/.my.cnf -e "show databases"
works without any issue from the shell