I am trying to do this in a script:
» sudo -u postgres createuser -PE -s user1
Enter password for new role:
I do not want postgres to ask for the password interactively, so I want to do:
» sudo -u postgres createuser -PE -s user1 < /tmp/xxx
Where /tmp/xxx contains the password for the new user. But it does not work. How to get this working?