The script has this code in dump():
db="${1}"
...
cmd_args=("${DB}")
Note how the first is in lower case, and the second in upper case. As a result, the DB argument is never passed to pg_dump, so it reverts to the default database (probably 'postgres'). If you have a db cluster with 10 databases, you get 10 identical backups of the default database, named after the different database. The 9 other backups are missing.
The script has this code in dump(): db="${1}" ... cmd_args=("${DB}")
Note how the first is in lower case, and the second in upper case. As a result, the DB argument is never passed to pg_dump, so it reverts to the default database (probably 'postgres'). If you have a db cluster with 10 databases, you get 10 identical backups of the default database, named after the different database. The 9 other backups are missing.