I am trying to run a shell script that run sql file from the given location and result out put create a file in another location. My problem is when I run the script it giving an error saying "syntax error: unexpected end of file" from following line.
psql -h 192.168.1.550 -U myuser -d DBONE -f /home/dbfunction/scripts/test.sql
my error code is like this,
if [ "$filename" != "*" ]; then
psql -h 192.168.1.550 -U myuser -d DBONE &> /home/dbfunction/results/report.txt -f /home/dbfunction/scripts/test.sql << EOF
EOF
fi
if i run the same command in terminal from the same location its running without any error. My manual running command is,
psql -h 192.168.1.550 -U myuser -d DBONE &> /home/dbfunction/results/report.txt -f /home/dbfunction/scripts/test.sql
I removed psql command line and EOF line and added some echo. Its working without any error. I think there is an issue between << EOF and EOF
Can anybody help me to resolve this??