So I will not forget how to do this.
To run my script in postgres without logging in:
I set the environment variables $PGHOST $PGUSER $PGPASSWORD $PGDATABASE
then run the postgresql script : psql $PGDATABASE -f sql_script.
My Life, My Work, Your Story.