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

<p>To fix this, if you have dos2unix installed, you can run:
    <code>dos2unix autogen.sh</code></p>

CC BY-SA 3.0
2017-07-31T04:29:01.780Z
2017-07-31T04:29:01.780Z
smhaziq
<p>This is how I resolved the issue using Git in Windows.  Note that it will reset your local with master.</p>

<pre><code>git config --global core.autocrlf false
git reset --hard origin/master
</code></pre>

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

CC BY-SA 3.0
2017-12-03T02:55:12.513Z
2017-12-03T02:55:12.513Z
Gabe
<p>I seems that you're in the wrong directory as in the <code>bitcoin</code> directory there is definitely the <code>autogen.sh</code>.</p>

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

CC BY-SA 3.0
2017-07-17T00:08:37.093Z
2017-07-17T00:08:37.093Z
Murch
<p>I installed Ubuntu on Windows, then cloned <a href="https://github.com/bitcoin/bitcoin" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin</a> in. </p>

<pre><code>cd bitcoin
./autogen.sh
</code></pre>

<p>Which returned this:</p>

<pre><code>: not foundh: 5: ./autogen.sh:
./autogen.sh: 6: set: Illegal option -
</code></pre>

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

<p>Thanks!</p>

<p>EDIT: Here is a screenshot:</p>

<p><img src="https://i.sstatic.net/o5Unv.png" alt="enter image description here"></p>

CC BY-SA 3.0
2017-08-30T05:09:29.650Z
`autogen.sh` is an `sh` script, not a `bash` script. What happens if you run `sh autogen.sh`?
Geremia
<bitcoin-core><compiling>
autogen.sh not working on Ubuntu on Windows
MattyAB
# autogen.sh not working on Ubuntu on Windows

(Asked by: username_0 on 2017-07-16)

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

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?
Thanks!
EDIT: Here is a screenshot:

**Tags:** bitcoin-core, compiling

> **Comments:**
> **username_1**: `autogen.sh` is an `sh` script, not a `bash` script. What happens if you run `sh autogen.sh`?  

---

## 3 answers

### Answer by username_2 on 2017-07-31. Score: 2

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`


---

### Answer by username_3 on 2017-12-03. Score: 1

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.


---

### Answer by username_4 on 2017-07-17. Score: 0

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?


---

