我有脚本:
#!/bin/sh
PSQLPATH=$1
USER=$2
if [ -z ${PSQLPATH} ]; then
echo "incorrect path param"
echo "Usage: $0 psqlpath username"
exit 1
fi
if [ -z ${USER} ]; then
echo "incorrect username param"
echo "Usage: $0 psqlpath username"
exit 1
fi
${PSQLPATH}/createdb -h localhost -U ${USER} highway2
${PSQLPATH}/psql -f createDatatable.sql -h localhost -d highway2 -U ${USER}
${PSQLPATH}/psql -f insertStatements.sql -h localhost -d highway2 -U ${USER}
echo "execute passed"
exit 0
当我尝试像 ./script.sh 一样执行它时,出现错误第 19 行:文件意外结束。我做错了什么?