How to provide a password for PostgreSQL's createdb non-interactively?
createdb
will use the PGPASSWORD environment variable if it's set, that's one simple way of providing a password in non-interactive runs.
Another option would be to set up a .pgpass file in the home directory of the unix user launching the createdb
.