No culd.
Cita: -W
--password
Force pg_dump to prompt for a password before connecting to a database.
This option is never essential, since pg_dump will automatically prompt for a password if the server demands password authentication. However, pg_dump will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.
Por el contrario, obliga al cliente que dispara la conexión la solicitud de password bajo cualquier circunstancia.
Mira la opción -w (minuscula) que dice:
Cita: -w
--no-password
Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.
Que en pocas palabras es algo parecido a lo que hiciste. Sino que recomiendan tener un archivo .pgpass para almacenar este tipo de variables.
saludos