Hi I have written this script to execute pgSQL function and I'm getting this error
#!/bin/bash
cd /home/NorthStar/Dhruva/server-specific-scripts/crons/ResetETA
db="Dhruva"
file="/home/NorthStar/Dhruva/server-specific-scripts/crons/ResetETA/query.sql"
cmd="psql -d $db -f $file"
su postgres -c "$cmd" >> reset.log 2> reset.log
if su postgres -c "$cmd"; then
echo "ETA Reset successed" >> resset.log
else
echo "ETA Reset faild" >> reset_error.log
fi
Looks like a Unicode byte-order mark.
Use a text editor that saves plain utf-8 text without a byte-order mark, like notepad++, Sublime Text, gedit, vim/emacs, etc to write your scripts.
Don't write SQL, or any other programming-style code, with a word processor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With