I have a bash script that runs a few psql commands. Every time a command is ran it prompts for user password. I'd like to make the script input the password automatically so I'd only need to run the script and not need to input anything. I am aware that I can do this for psql
PGPASSWORD=root psql -h localhost -d $db_name -U root -c
but I'd like to know how to automate input in general/