I installed Ubuntu on Windows, then cloned https://github.com/bitcoin/bitcoin in.

cd bitcoin

Which returned this:

: not foundh: 5: ./autogen.sh:
./autogen.sh: 6: set: Illegal option -

What am I doing wrong here? Have I missed something, or do I need to raise it as an issue on GitHub?


EDIT: Here is a screenshot:

enter image description here

  • autogen.sh is an sh script, not a bash script. What happens if you run sh autogen.sh? – Geremia Aug 30 '17 at 5:09

This means your file has DOS newlines thus, hidden CR characters at the end. Thus, set -e becomes set -e$'\r' (using bash-specific syntax to represent the CR character), which isn't a valid option.

To fix this, if you have dos2unix installed, you can run: dos2unix autogen.sh


This is how I resolved the issue using Git in Windows. Note that it will reset your local with master.

git config --global core.autocrlf false
git reset --hard origin/master

I was then able to use the Ubuntu subsystem in Windows to run ./autogen.sh without the error in the OP.


I seems that you're in the wrong directory as in the bitcoin directory there is definitely the autogen.sh.

Are you sure you are in the same bitcoin directory that you had just cloned? What does ls (list directory contents) return?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.