0

I'm really struggling with a bash command, trying to launch a mysql query :

output=$(mysql --user=root --password="$password" -s --execute 'grant all privileges on zabbix.* to zabbix@localhost identified by "$zabbix_pwd";')

The statement above does not work, because $zabbix_pwd is not take as a variable, as it should...

Any idea on how to rewrite this statement would be very helpful.

Cheers,

Raj.

Rajstopy
  • 3
  • 2

1 Answers1

0

Your escaping is wrong. Please try this :

output=$(mysql --user=root --password="$password" -s --execute "grant all privileges on zabbix.* to zabbix@localhost identified by \"$zabbix_pwd\";")

Hope it helps.

Matias Barrios
  • 4,674
  • 3
  • 22
  • 49