I need to take a backup of my database using mysqldump tool. My test table has a TIMESTAMP column that I have to use as filter. I'm using a bash script with the following code:
#!/bin/bash
cmd="mysqldump --verbose --opt --extended-insert --result-file /home/backups/mysql/test/test_table.20161205.bak test --where=\"timestamp_c>='2016-12-03 00:00:00'\" --tables \"test_table\""
echo $cmd
$cmd
I'm printing the command that I assume should work. The above script produces the output:
mysqldump --verbose --opt --extended-insert --result-file /home/backups/mysql/test/test_table.20161205.bak test --where="timestamp_c>='2016-12-03 00:00:00'" --tables "test_table"
If I copy the printed command on the terminal, it works; however, the command on the script print the error:
mysqldump: Couldn't find table: "00:00:00'""
Is there something that I'm not understanding about quotes escape?