shell脚本调试报错:"syntax error: unexpected end of file"
来源:互联网 发布:nginx代理上网 编辑:程序博客网 时间:2024/06/06 07:17
当我使用window文本工具编写Unix的shell脚本并使用rz命令上传到Unix系统运行时总是报错"syntax error: unexpected end of file",后来才发现,window系统和Unix系统之间的编码方式是不同的。
以前的打字机换行分为两步:复位和走纸,但不同的操作系统中复位和走纸的表示方法不同。
以前的打字机换行分为两步:复位和走纸,但不同的操作系统中复位和走纸的表示方法不同。
于是,unix/mac下的文件如果在windows里打开,所有文字会变成一行;而windows的文件在unix/mac下打开,每行的结尾会多出一个 ^M 符号。
我想在linux下执行一个shell脚本,而它恰巧又在windows中打开过,于是我就狠狠地摔在了这个坑里。解决的办法自然很简单,一个dos2unix命令即可。
OS表示C语言/转义字符HEX表示Window回车+换行符(CR/LF)\r\n0x0d0aUnix/Linux换行(LF)\n0x0aMac OS回车(CR)\r0x0d
0 0
- 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
- php报错 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 提示错误
- 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
- Shell中EOF出现syntax error: unexpected end of file
- Linux Shell syntax error: unexpected end of file
- shell中出现syntax error: unexpected end of file
- 20151201正则第三部分(sed) 最强的功能是替换!
- 使用Alcatraz来管理Xcode插件
- 距离和相似性度量
- 简单LRU算法实现的Cache(C++)
- fvnhsdfhdfsh
- shell脚本调试报错:"syntax error: unexpected end of file"
- MQ入门简介
- Android Studio 快捷键
- 测试代码片
- Spring Http Invoker
- 自动定义瀑布流控件的实现<二>
- Android Studio 中使用github功能
- NLTK命名实体识别
- 集算器集成与应用之BIRT集成