I have installed Windows subsystem for Linux on my Windows 10 machine which is supposed to be emulating Ubuntu 16.04. When I try to execute a script that has the following 2 lines at the top of the script, it gives me the error :invalid option name set: pipefail
Script lines:
#!/bin/bash
set -eo pipefail
This script runs fine on my Mac and on a CentOS system I have. I have checked
(and verified) my Ubuntu shell to ensure it supports the pipefail option in bash by running set -o
.
The output of cat -net /path/to/myscript
is:
#!/bin/bash^M$
set -eo pipefail^M$
This question was marked as a duplicate of "How to change Windows line-ending to Unix version" but I do not feel it is duplicative of that because I personally did not know that the problem I was having (that is outlined in my question) was being caused by the type of line-ending in my shell script. The answer in each of the questions is the same but 2 different questions were asked.