Postgresql – Hiding variable input in psql

postgresqlpsql

I am attempting to prompt for a username and password when running a database creation script, and I want to hide any text input for my password prompt. In Oracle's sqlplus, I can use HIDE at the end of the line to suppress the user's input from appearing on the screen. Is there an equivalent for PostgreSQL's psql?

Current progress:

\prompt 'Enter database user password: ' ss_password

Best Answer

\password username

... will change the password for a given username, whilst suppressing the inputted password. I don't know of a way to do it for a given variable.