简体   繁体   English

Shell脚本无法在Cygwin中运行

[英]Shell script can't be run in cygwin

I have a script as below: 我有一个如下脚本:

# /brickos/util/f.sh
set folder=`pwd`
cd /brickos/boot
make
firmdl3 -f brickOS.srec
cd $folder

when I run it in cygwin(minty.exe), I got error as below, but when I run them in terminal directly, no any errors! 当我在cygwin(minty.exe)中运行它时,出现以下错误,但是当我直接在终端中运行它们时,没有任何错误! what can I do? 我能做什么?

$ f.sh
/cygdrive/c/cygwin/brickos/util/f.sh: line 2: cd: /brickos/boot
: No such file or directory
/cygdrive/c/cygwin/brickos/util/f.sh: line 3: $'make\r': command not found
firmdl3: ERROR- failed to open brickOS.srec
/cygdrive/c/cygwin/brickos/util/f.sh: line 5: cd: 
: No such file or directory
$'make\r': command not found

suggests the script is saved with Windows (CRLF) instead of Unix style (just LF) line endings. 建议使用Windows(CRLF)而不是Unix风格(仅LF)的行尾保存脚本。 Try converting it to Unix format and see if that improves matters. 尝试将其转换为Unix格式,看看是否可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM