【发布时间】:2021-05-11 04:07:17
【问题描述】:
我在尝试执行 shell 脚本时遇到以下错误,
$'\r': command not found: line 2:
请提出相同的解决方案。
以下是脚本中使用的初始行,
#!/bin/sh
if [[ $# -lt 1 ]]; then
echo "ERROR Environment argument missing <dev,test,qa,prod>"
export RC=50
exit $RC
fi
【问题讨论】:
-
你的 shell 脚本的前两三行是什么? :)
-
请发布整个脚本或足够的脚本,以便人们重现问题
-
\r\n 是 Windows 行尾。你是在 Windows 中写的吗?如果是这样,只需重新输入:P
-
哇,别再打字了:
dos2unixit
标签: shell