MarkS Note
Thursday, January 27, 2011
解决window下编写的脚本无法在linux下执行
轉:http://www.8qiu.cn/2010/06/1301/
Posted on
2010/06/13
by
admin
普通文本文件中window的行结束符是回车符(\r)
而linux的是换行符(\n)
window的文本文件里的回车符在linux里被解析成Ctrl-M (^M)字符
window编写的shell脚本在linux里就会有如下错误
?
View Code
SHELL
/bin/sh^M: bad interpreter:
解决方法就是用linux命令dos2unix进行转换
?
View Code
SHELL
dos2unix filename
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment