sudo -u postgres -i pg_dump ENTER_db_name_here > /var/ENTER_db_name_here_"$(date +%Y-%m-%d_%H%M%S)".sql \
&& sudo -u postgres psql -c "DROP DATABASE ENTER_db_name_here WITH(FORCE);" \
&& sudo -u postgres psql -c "CREATE DATABASE ENTER_db_name_here;"
as separate commands:
sudo -u postgres -i pg_dump ENTER_db_name_here > /var/ENTER_db_name_here_"$(date +%Y-%m-%d_%H%M%S)".sql
sudo -u postgres psql -c "DROP DATABASE ENTER_db_name_here WITH(FORCE);"
sudo -u postgres psql -c "CREATE DATABASE ENTER_db_name_here;"