背景:
windows下编辑shell脚本,报错
syntax error near unexpected token ‘$’ r”
问题产生原因:
因为windos与linux换行符不同导致。
notepad++中,“视图->显示符号->显示所有符号”,然后可以看到所有的 回车 换行 对应windows的CR LF:
解决方案:
notepad++:“编辑->档案格式转换->转换为UNIX格式” (保存即可)
');
/*! This file is auto-generated */
!function(e,a,t){var n,r,o,i=a.createElement("canvas"),p=i.getContext&&i.getContext("2d");function s(e,t){var a=String.fromCharCode,e=(p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,e),0,0),i.toDataURL());return p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,t),0,0),e===i.toDataURL()}function c(e){var t=a.createElement("script");t.src=e,t.defer=t.type="text/javascript",a.getElementsByTagName("head")[0].appendChild(t)}for(o=Array("flag","emoji"),t.supports={everything:!0,everythingExceptFlag:!0},r=0;r 背景: windows下编辑shell脚本,报错 syntax e… 背景: windows下编辑shell脚本,报错 syntax error near unexpected token ‘$’ r” 问题产生原因: 因为windos与linux换行符不同导致。 notepad++中,“视图->显示符号->显示所有符号”,然后可以看到所有的 回车 换行 对应windows的CR LF: 解决方案: notepad++:“编辑->档案格式转换->转换为UNIX格式” (保存即可) 【Linux中shell脚本】Linux中shell脚本回车换行问题