Need to call env file in shell script
PGHOST=${PGHOST-'local host'}
PGPORT=${PGPORT-5432}
PGDATABASE=${PGDATABASE-'mydb'}
PGUSER=${PGUSER-'myuser'}
PGPASSWORD=${PGPASSWORD-'pwd#0000'}
My shell script
#!/bin/bash
export MYPATH ="C/Documents/my_env.env":$MYPATH
# If psql is not available, then exit
if ! command -v psql > /dev/null ; then
echo "This script requires psql to be installed and on your PATH. Exiting"
exit 1
fi
RUN_PSQL="psql -X --set AUTOCOMMIT=off --set ON_ERROR_STOP=on "
${RUN_PSQL} <<SQL
select count(1) from my_table
SQL
When I try to run it throws error saying syntax error unexpected end of file and warning here document delimited by end of file.