change MySQL commands to PostgreSQL in a bash script
I think I've cracked it...with a LOT of Googling and chopping of code!

DBS="$(sudo -u postgres psql -l -t | cut -d'|' -f1 | sed -e 's/ //g' -e '/^$/d')"

and;

sudo -u postgres $PGDUMP -Fc --verbose $db | $GZIP &gt; $FILE

# get all database listing
DBS="$(sudo -u postgres psql -l -t | cut -d'|' -f1 | sed -e 's/ //g' -e '/^$/d')"

# start to dump database one by one
for db in $DBS
do
        DUMP="yes";
        if [ "$IGNOREDB" != "" ]; then
                for i in $IGNOREDB # Store all value of $IGNOREDB ON i
                do
                        if [ "$db" == "$i" ]; then # If result of $DBS(db) is equal to $IGNOREDB(i) then
                                DUMP="NO";         # SET value of DUMP to "no"
                                #echo "$i database is being ignored!";
                        fi
                done
        fi

        if [ "$DUMP" == "yes" ]; then # If value of DUMP is "yes" then backup database
                FILE="$BACKUPDIR/$NOW-$db.sql.gz";
                 echo "BACKING UP $db";
                      sudo -u postgres $PGDUMP -Fc --verbose $db | $GZIP &gt; $FILE
        fi
done