I’m trying to insert the date into the .sql file name when making a backup.
#!/bin/bash
sudo mysqldump --databases data > data-backup-$(date "+%D--%T").sql
But I get this error as output
./backup.sh: line 2: data-backup-$(date "+%D--%T").sql: No such file or directory
But when I exec the same command but without the date inserted there is no such error.
>Solution :
date "+%D--%T" outputs something like 12/18/21--00:19:21.
/ is not allowed in file names with Linux/Unix.