脚本报syntax error near unexpected token `(',
来源:互联网 发布:人知将死 其言也善后句 编辑:程序博客网 时间:2024/05/08 23:24
本来可以跑的脚本,最近忽然在运行时报syntax error near unexpected token `(',,但代码语法看起来并没有什么明显的错误 。
怀疑是用特殊字符造成的,使用"vi -b 文件名"打开后,就看到每行后面多了个"^M",即Windows方式的换行符。
原来有人下载到Windows后,用记事本编辑保存过,变成Windows方式的换行符了。
那就简单了, 使用Linux下的命令工具去掉Windows换行符即可.
使用 "dos2unix 文件名 " 即将Windows的换行符从"\r\n"转为"\n"了。
与这个命令相对的,有个unix2dos命令可反向转换.
也可以用vi下的替换方式处理这种情况:
:%s/^M//g
替换掉"^M", ^M由ctrl+v 和 ctrl+m 生成而不是直接输入对应的字符。
MAIL: xcl_168@aliyun.com
BLOG: http://blog.csdn.net/xcl168
0 0
- 脚本报syntax error near unexpected token `(',
- rsync 脚本报错 “syntax error near unexpected token `(”
- shell 脚本报错^M: syntax error near unexpected token
- 脚本报错:syntax error near unexpected token
- syntax error near unexpected token `
- syntax error near unexpected token `('
- “syntax error near unexpected token `”
- syntax error near unexpected token `
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
- linux执行SHELL脚本报错“syntax error near unexpected token `in”解决
- linux执行SHELL脚本报错“syntax error near unexpected token `in”解决
- linux执行SHELL脚本报错“syntax error near unexpected token `in”解决
- 运行shell脚本报错: syntax error near unexpected token `'\r''
- shell编程报错:“syntax error near unexpected token `”
- cygwin shell报错: syntax error near unexpected token `$'{/r''
- shell编程报错:“syntax error near unexpected token `”
- shell编程报错:“syntax error near unexpected token `”
- shell---shell编程报错:“syntax error near unexpected token `”
- 简单排序二--冒泡排序、选择排序、插入排序练习
- Android开发一些常用的颜色值
- Android 下拉列表Spinner控件
- 浅谈代理服务器的作用
- C++之构造函数和析构函数总结
- 脚本报syntax error near unexpected token `(',
- JavaScript程序设计之常用文档对象
- POJ 3278 Catch That Cow BFS(第一题)
- 参数化查询为什么能够防止SQL注入
- Dev gridcontrol获取选定行,指定列单元格的内容
- OpenCV学习(五)平滑滤波
- Cocos2dx 3.0rc 创建工程、交叉编译至android 的懒人脚本
- Struts2拦截器的实例
- 约瑟夫环:用java解决的一种办法