Shell—常见报错问题

编程

bash:$"": command not found

造成这个问题的原因是Windows环境下换行的“”到了Linux环境下不能够识别了,因为Linux环境下默认的换行符为“

”,我们只需要把文件转成unix就好。使用 dos2unix 工具实现该转换。

# 1.安装 dos2unix 工具

[root@localhost ~]# apt install dos2unix # Ubuntu系统

[root@localhost ~]# yum -y install dos2unix # Centos系统

# 2.转换文件

[root@localhost ~]# chmod 755 test.sh

[root@localhost ~]# dos2unix test.sh

# 3.再次执行文件就可以啦

[root@localhost ~]# sh ./test.sh

 

以上是 Shell—常见报错问题 的全部内容, 来源链接: utcz.com/z/510867.html

回到顶部