在shell脚本命令中未找到错误,如何解决?

时间:2020-02-19 11:00:02

标签: bash shell unix sh

我遇到了这些错误:意外令牌'$'\ r' $'\ r'附近的语法错误:找不到命令 我正在使用运行在云外壳程序(https://ssh.cloud.google.com/cloudshell/)上的Windows 10和notepad ++编辑器

2 个答案:

答案 0 :(得分:0)

错误-> 第1行:$':\ r':找不到命令

->要解决通过notepad ++打开此文件,然后在右下角有 Windows(CLRF)选项,右键单击该文件,更改为Unix(LF),然后运行代码。

这是针对Windows 10的

enter image description here

答案 1 :(得分:0)

除了在notepad ++中执行此操作外,您还可以直接在unix上的shell脚本上直接运行dos2unix