The underscore in this line of code:
TARGET_FILE=$DIR/$DB$_(date +%Y%m%d)$EXTENSION
isn't recognized by bash as intended, and is omitted, resulting in just the date being used as the file name, which causes overwrites if you use the same directory for backups of different databases. I eliminated the issue by changing it to this:
TARGET_FILE=$DIR/$DB$(date +%Y%m%d)$EXTENSION
The underscore in this line of code:
TARGET_FILE=$DIR/$DB$_(date +%Y%m%d)$EXTENSION
isn't recognized by bash as intended, and is omitted, resulting in just the date being used as the file name, which causes overwrites if you use the same directory for backups of different databases. I eliminated the issue by changing it to this:
TARGET_FILE=$DIR/$DB$(date +%Y%m%d)$EXTENSION