shell:$' ': command not found

执行shell脚本时出现这个问题:$' ': command not found

如图:

 (实际上路径后边是没有 的)

原因:脚本在windows下编写,结尾是 的;Unix 结尾是   所以在Linux下运行脚本 , 是一个字符,所以运行错误

解决办法:sed -i 's/ //' 脚本名

或者vi 文件,在命令模式下输入:set ff=unix,保存即可

本文转自https://www.cnblogs.com/manhelp/p/11277584.html

原文地址:https://www.cnblogs.com/jinziguang/p/12518751.html