linux shell脚本无法执行,报错syntax error near unexpected token `$‘r‘‘解决方法

    技术2022-07-11  146

    运行shell脚本时出现:syntax error near unexpected token `$’\r“的错误,一般是格式的问题,比如直接从txt文档拷贝过来的内容; 例如test.sh脚本 解决方法:sed -i ‘s/\r//g’ test.sh 然后再执行 sh test.sh

    Processed: 0.013, SQL: 9