linux ubuntu bash shell报错 xxx.sh: Syntax error: end of file unexpected (expecting “then“)
程序员文章站
2022-05-30 16:39:03
...
代码:run.sh
# creat log dir if it not exists
logDir="./ckpt/"$timeDir
if [ ! -d $logDir ]; then
mkdir $logDir
else
echo $logDir exist
fi
报错:
$ sh run.sh
: not foundrun.sh:
run.sh: 16: run.sh: Syntax error: end of file unexpected (expecting "then")
解决:
需要转换脚本编码方式
$ sudo apt-get install dos2unix
$ dos2unix run.sh
https://blog.csdn.net/qq_38989148/article/details/105340521
推荐阅读
-
shell 环境中的报错 syntax error:unexpected end of file
-
shell脚本报错syntax error: unexpected end of file
-
windows--Linux 执行Shell脚本报错 “syntax error: unexpected end of file”
-
linux ubuntu bash shell报错 xxx.sh: Syntax error: end of file unexpected (expecting “then“)
-
Linux 执行 Shell脚本报错,“syntax error: unexpected end of file” 原因及处理
-
syntax error: unexpected end of file。shell脚本执行报错
-
[Linux]Shell脚本“syntax error: unexpected end of file”报错及处理
-
Shell报错syntax error: unexpected end of file