is it possible to run the psql without enter the password ?
I mean how to set the password word in the CLI ( by expect or other way ) so I will not enter the password
goal - I need to run this psql from bash script
psql -U ambari ambari -c "select * from blueprint" --> HDP
Password for user ambari:
blueprint_name | security_type | security_descriptor_reference | stack_id
----------------+---------------+-------------------------------+----------
HDP | NONE | | 2
(1 row)
I am also try this but without success - why ?
su - postgres -c " psql -tc \"SELECT * FROM BLUEPRINT\" "
ERROR: relation "blueprint" does not exist
LINE 1: SELECT * FROM BLUEPRINT
^
second
how to capture the first word after "blueprint_name"
meanwhile I use this but not satisfied about this approach
psql -U ambari ambari -c "select * from blueprint" | grep -v row | tail -2 | awk '{print $1}'
Password for user ambari:
HDP