shell脚本内容拷贝出来 执行正常 sh执行报错

2026-04-14 18:56:48

1、shell脚本test.sh内容是

find /home/feel/ -name test.txt;

find /home/feel/ -name test2.txt;

find /home/feel/ -name test3.txt;

拷贝出来,放到命令行,执行正常。

shell脚本内容拷贝出来 执行正常 sh执行报错

2、sh test.sh,执行报错。

①②③: command not found

shell脚本内容拷贝出来 执行正常 sh执行报错

3、报错原因,test.sh在windows编写,windows的某些字符和Linux不一样,导致在Linux执行失败。

shell脚本内容拷贝出来 执行正常 sh执行报错

4、解决方法,在Linux删除在windows创建的test.sh,创建文件test.sh,执行正常。

shell脚本内容拷贝出来 执行正常 sh执行报错

猜你喜欢