I have made script for the postgresql dump but unable to get dump only using command line as it require the password when execute the script.
list of database command require Password after enter
psql -l -t | cut -d'|' -f1 | sed -e 's/ //g' -e '/^$/d'
same for pg_dump
pg_dump $i|gzip > $backupfile