$‘\r‘: command not found原因及解決辦法
阿新 • • 發佈:2020-12-18
技術標籤:livingbody
$’\r’: command not found原因及解決辦法
1.問題描述
Message-Id: <[email protected]>
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <[email protected]> sh /root/AutoCutout/webcron.sh
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: < SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
/root/AutoCutout/webcron.sh: line 2: $'\r': command not found
/root/AutoCutout/webcron.sh: line 4: cd: $'/root/AutoCutout\r': No such file or directory
/root/AutoCutout/webcron.sh: line 5: conda: command not found
lsof: unacceptable port specification in: -i :80\r
2.原因分析
- 經過查詢,得知,原來是windows和linux的sh一些檔案格式不同。
- 以換行為例,windows是\r\n,而Linux是\n。所以linux下報錯’\r’: command not found
3.解決辦法
:set ff=unix
:wq