postgresql コマンドを実行するためのシェル スクリプトを作成しました。問題は、このスクリプトを実行しているときにエラーが表示されることです: line 17: psql: command not found
私のスクリプトは次のとおりです。
export PGPASSWORD=${PGPASSWORD-my_password}
echo "enter host"
read host
echo "enter database name"
read dbname
echo "enter username"
read username
psql -h $host $dbname $username <<EOF
SELECT * FROM test ; >>res.txt
EOF
( cat res.txt) | sed 's/;/<tab>/g' > $file.csv
rm res.txt
unset PGPASSWORD
私が間違っていることを教えてください。