theaudioforum
04-28-2004, 10:55 PM
I would like to append the date to the filename of a MySQL backup that I am performing via a shell script.
Simplified script:
#!/bin/sh
databases="mysql theaudioforum"
today='date +%Y-%m-%d'
for database in $databases
do
mysqldump -u root --opt $database > /backups/${database}-$today.sql
done
####
I end up with files named like this: mysql-date +%Y-%m-%d.sql
How can I correct the script so that I end up with a file named like: mysql-2004-4-29.sql ?
Thanks!!
Simplified script:
#!/bin/sh
databases="mysql theaudioforum"
today='date +%Y-%m-%d'
for database in $databases
do
mysqldump -u root --opt $database > /backups/${database}-$today.sql
done
####
I end up with files named like this: mysql-date +%Y-%m-%d.sql
How can I correct the script so that I end up with a file named like: mysql-2004-4-29.sql ?
Thanks!!