Errors running bash script from pandoc filters repo in WSL


I’m trying to run 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 I got the following error:

: not found: 4:

: not found: 7: 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?

>Solution :

Are you attempting to run a shell script with CRLF line endings?

Use file to confirm.

git will checkout files using CRLF line endings on windows if core.autocrlf is true.

Use git config core.autocrlf from the cloning machine (not necessarily the WSL2) to confirm.

To disable this behavior and reset your working directory:

git config core.autocrlf false
git checkout -- .

Leave a Reply Cancel reply