linux下.sh文件执行报错

文章目录

运维相关

一、Linux命令之dos2unix
1.简介:
dos2unix:将DOS格式文件转换成UNIX格式。
参数:

-k:保持文件时间戳不变
例:dos2unix -k **.sh
-n:转换结果另存为
例:dos2unix  -n old.sh new.sh

2.问题实例:

[root@K home]# ./test.sh 
bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory

3.解决方法:

[root@K home]# dos2unix test.sh
[root@K home]# ./test.sh

猜你喜欢

转载自blog.csdn.net/weixin_42163329/article/details/106357909