I'm trying to store the date in a variable ($DATE
) so I can use it later, but it doesn't seem to work. See anything wrong?
DATE=$(date +"%Y-%m-%d %R")
sudo mysqldump -u root -pnotgivingyoumypassword --all-databases > ~/mysql_backups/$DATE.sql
cd /var/www && sudo tar -czf ~/www_backups/$DATE.tar ./
Update The error message is:
get:tar: 20\:41.tar: Cannot stat: No such file or directory tar: Exiting with failure status due to previous errors
It appears to work for the mysql dump, but it fails when using it in the last command.