Linux-006-执行Shell脚本报错 $' ':command not found
Posted 范丰平
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux-006-执行Shell脚本报错 $' ':command not found相关的知识,希望对你有一定的参考价值。
在 windows 下编写 Shell 脚本,在 Linux 上执行时,报错提示: $‘ ‘:command not found。
因为 windows 下的换行符是 ,而 Linux 的换行符是 。因而在 Linux 下运行 windows 编写的 Shell 脚本,会报如上所示的错误。
解决方法:将换行符替换成 Linux 平台的换行符即可。命令如下所示:
sed -i ‘s/ //‘ 脚本名
以上是关于Linux-006-执行Shell脚本报错 $' ':command not found的主要内容,如果未能解决你的问题,请参考以下文章
shell脚本执行报错[: 0: unary operator expected
执行shell脚本报错Syntax error: “(“ unexpected