0
postgresql 명령을 실행하기위한 쉘 스크립트를 작성했습니다. 다음과 같이 line 17: psql: command not found
bash 스크립트에서 Postgresql 명령 실행
내 스크립트는 다음과 같습니다 :
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
내가 잘못 뭐하는 거지 저를 제안하십시오 내가 오류를 보여주는이 스크립트를 실행하고 할 때 문제입니다.
가되지 않습니다 제공해야 : psql : 명령을 찾을 수 없습니다'? psql에 대한 전체 경로를 지정하거나 존재하지 않는 경우 설치해야합니다. – devnull
@devnull. 하지만 난 이미 psql을 설치했습니다 –
@DEVANGPANDEY'whereis psql'에 대한 출력을 보여줄 수 있습니까? – Antarus