I am writing a shell script to automate the sql metadata backup everyday. I am stuck in between. My approach is to backup sql metadata everyday and delete the old backups keeping last 3 backup for safety. Please help me out with the command to delete the previous backups keeping the last 3 backups.
FILE= mysql_metadata_backup_$( date '+%Y-%m-%d_%H-%M-%S' ).sql
mysqldump -u userID --all-databases > ${FILE}