解决问题
查找换行符号:find命令
find . -type f -name '*.sh' | xargs file |grep CRLF
复制
替换换行符号
find . -name '*.sh' | xargs -I {} perl -pi -e 's/\r//g' {}
开始一直没有找到文件的问题,最后发现是格式的问题
该文章描述了一个在Linux环境中使用find命令查找并处理.sh脚本中包含CRLF换行符的问题。通过管道连接find,xargs和perl命令,实现了查找和替换.sh文件中的
字符,从而修正了因格式问题导致的找不到文件的错误。
查找换行符号:find命令
find . -type f -name '*.sh' | xargs file |grep CRLF
复制
替换换行符号
find . -name '*.sh' | xargs -I {} perl -pi -e 's/\r//g' {}
开始一直没有找到文件的问题,最后发现是格式的问题
2393
1353

被折叠的 条评论
为什么被折叠?
