I have a shell script which I pass RDS postgres host into, within the script I can connect to postgres db via command below within script. How can I pass psql commands into the shell script to verify a table ? or list all db ? like
\dt
\l
psql "host=$RDSHOST port=5432 sslmode=disable dbname=mydbname user=testuser password=$PASSWORD"
I get the prompt to DB no issue, would like to pass some commands to verify a db exists or list a table and exit the shell script with its output.