Shelll 错误 syntax error: unexpected end of file
2010-03-27 11:41
609 查看
今天shell一直运行正常,修改了几次,反倒不能运行了,我是在windows下修改的shell,开始怀疑是windows和linux文件格式转换错误,看了网上的也有说是这个,但是我的几经修改还是不行,最后发现时语法错误---多了一个引号。
echo "Dir " $WORK_DIR has already exist "------- 就是这个错误;修改为 echo "Dir $WORK_DIR has already exist "。
下面是其他解决方式。
1, dos文件转换成unix文件格式
dos格式文件传输到unix系统时,会在每行的结尾多一个^M,当然也有可能看不到,但是在vi的时候,会在下面显示此文件的格式,比如
"dos.txt" [dos] 120L,
2532C字样,表示是一个[dos]格式文件,如果是MAC系统的,会显示[MAC],因为文件格式的原因有时会导致我们的unix程序,或者
shell程序出现错误,那么需要把这些dos文件格式转换成unix格式,方法是
vi dos.txt
:set fileformat=unix
:w
这样文件就转换成unix格式文件了,一般在windows机器上编写好了文件传到unix下就可能会出现这样的情况,而一般我们使用ftp命令,常常会加上bin参数表示二进制传输,可是试一下不加bin参数,可能传到unix下就是unix格式
echo "Dir " $WORK_DIR has already exist "------- 就是这个错误;修改为 echo "Dir $WORK_DIR has already exist "。
下面是其他解决方式。
1, dos文件转换成unix文件格式
dos格式文件传输到unix系统时,会在每行的结尾多一个^M,当然也有可能看不到,但是在vi的时候,会在下面显示此文件的格式,比如
"dos.txt" [dos] 120L,
2532C字样,表示是一个[dos]格式文件,如果是MAC系统的,会显示[MAC],因为文件格式的原因有时会导致我们的unix程序,或者
shell程序出现错误,那么需要把这些dos文件格式转换成unix格式,方法是
vi dos.txt
:set fileformat=unix
:w
这样文件就转换成unix格式文件了,一般在windows机器上编写好了文件传到unix下就可能会出现这样的情况,而一般我们使用ftp命令,常常会加上bin参数表示二进制传输,可是试一下不加bin参数,可能传到unix下就是unix格式
相关文章推荐
- 在执行shell脚本时,出现“syntax error : unexpected end of file"错误的解决方法
- Shelll 错误 syntax error: unexpected end of file
- 解决shell错误:syntax error: unexpected end of file
- 解决shell错误:syntax error: unexpected end of file
- SHELL syntax error:unexpected end of file 提示错误
- shell错误一例 syntax error: unexpected end of file
- SHELL syntax error:unexpected end of file 提示错误
- SHELL syntax error:unexpected end of file 提示错误; windows下修改linux文件导致linux文件无法使用
- SHELL syntax error:unexpected end of file 提示错误
- SHELL syntax error:unexpected end of file 提示错误
- shell脚本“syntax error:unexpected end of file”解决方案
- php出现如下错误: Parse error: syntax error, unexpected end of file in
- shell syntax error: unexpected end of file
- shell:syntax error:unexpected end of file/Starting proxy www-balancer: cannot bind socket--转载
- shell中出现syntax error: unexpected end of file
- linux脚本相关: Syntax error: end of file unexpected (expecting "then") 提示错误
- 关于shell文件中出现syntax error: unexpected end of file
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
- SHELL syntax error:unexpected end of file 提示错误
- shell脚本“syntax error:unexpected end of file”解决方案