主要原因是在windows中编译文件格式导致
linux下解决:
方案一: Linux下打开shell文件,用vi/vim命令打开脚本文件,输入“:set fileformat=unix”,回车,保存退出。
方案二: yum install -y dos2unix
dos2unix xxx.sh
方案三:vim -b xxx.sh
sed -i ‘s/\r//g’ xxx.sh
windows开发环境解决IDEA编辑器
在编辑器右下角有这个文件格式,选择LF即可,这样项目打包后传到linux中脚本就不会乱码了
02-28
507
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-09
7325
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-23
478
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-13
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交