英文:
Errors running bash script from pandoc filters repo in WSL
问题
我试图在我的本地机器上使用WSL运行runtests.sh脚本,来源是这个仓库。首先,我使用wsl --install Ubuntu安装了WSL。然后,我进入了本地克隆的目录并运行了sh runtests.sh。我得到了以下错误:
: 找不到命令: 4:
:
: 找不到命令: 7:
:
runtests.sh: 8: 语法错误: “do” 期望的是:do
我对bash脚本不太熟悉,但我相当确定这个脚本应该可以工作,因为它是一个维护得相当好的仓库的一部分。我肯定是在调用脚本时出了问题。
在这里我做错了什么?
英文:
I'm trying to run runtests.sh from this repo on my local machine using WSL. First I installed WSL using wsl --install Ubuntu. Then I navigated to my local clone and ran sh runtests.sh. I got the following error:
> : not found: 4:
>
> : not found: 7:
>
> runtests.sh: 8: Syntax error: word unexpected (expecting "do")
I'm not too familiar with bash scripts, and I'm pretty sure this one should work, since it's part of a reasonably well maintained repo. There has got to be something wrong with how I'm calling the script.
What am I doing wrong here?
答案1
得分: 1
你是否尝试运行带有CRLF行尾的Shell脚本?
使用 file runtests.sh 进行确认。
如果 core.autocrlf 的值为 true,Git 将在Windows上检出带有CRLF行尾的文件。
使用 git config core.autocrlf 进行确认。
要禁用此行为并重置您的工作目录:
git config core.autocrlf false
git checkout -- . # 注意:这将覆盖工作目录中的更改 <><>
英文:
Are you attempting to run a shell script with CRLF line endings?
Use file runtests.sh to confirm.
git will checkout files using CRLF line endings on windows if core.autocrlf is true.
Use git config core.autocrlf to confirm.
To disable this behavior and reset your working directory:
git config core.autocrlf false
git checkout -- . # CAVEAT: This will overwrite working directory changes <>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论