âset -eo pipefailâ not working in Windows Subsystem for Linux (Ubuntu 16.04) [duplicate]

 Clash Royale CLAN TAG#URR8PPP
Clash Royale CLAN TAG#URR8PPP up vote
1
down vote
favorite
This question already has an answer here:
 How to change Windows line-ending to Unix version [duplicate]
 
 1 answer
 
 
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.
16.04 bash windows-10 windows-subsystem-for-linux
 marked as duplicate by Melebius, Eric Carvalho, user535733, Kevin Bowen, MadMike Jun 8 at 9:24
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
1
down vote
favorite
This question already has an answer here:
 How to change Windows line-ending to Unix version [duplicate]
 
 1 answer
 
 
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.
16.04 bash windows-10 windows-subsystem-for-linux
 marked as duplicate by Melebius, Eric Carvalho, user535733, Kevin Bowen, MadMike Jun 8 at 9:24
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This question already has an answer here:
 How to change Windows line-ending to Unix version [duplicate]
 
 1 answer
 
 
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.
16.04 bash windows-10 windows-subsystem-for-linux
This question already has an answer here:
 How to change Windows line-ending to Unix version [duplicate]
 
 1 answer
 
 
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.
This question already has an answer here:
 How to change Windows line-ending to Unix version [duplicate]
 
 1 answer
 
 
16.04 bash windows-10 windows-subsystem-for-linux
edited Jun 8 at 9:56
asked Jun 6 at 20:02


phydeauxman
83
83
 marked as duplicate by Melebius, Eric Carvalho, user535733, Kevin Bowen, MadMike Jun 8 at 9:24
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
 marked as duplicate by Melebius, Eric Carvalho, user535733, Kevin Bowen, MadMike Jun 8 at 9:24
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
add a comment |Â
 1 Answer
 1
 
active
oldest
votes
up vote
3
down vote
accepted
As indicated by the ^M sequences in your cat -net output, you have saved the script with Windows-style (CRLF) line endings rather than Unix-style (LF only)
In fact, we could have guessed that from the truncated error message; the "real" error is that pipefailr is an invalid option name, however the carriage return causes the cursor to reset to the start of the line and overwrite the preceding characters - compare
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo fhqwhgads$
$ ./bad.sh
./bad.sh: line 2: set: fhqwhgads: invalid option name
but
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo pipefail^M$
$ ./bad.sh
: invalid option name: pipefail
add a comment |Â
 1 Answer
 1
 
active
oldest
votes
 1 Answer
 1
 
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
As indicated by the ^M sequences in your cat -net output, you have saved the script with Windows-style (CRLF) line endings rather than Unix-style (LF only)
In fact, we could have guessed that from the truncated error message; the "real" error is that pipefailr is an invalid option name, however the carriage return causes the cursor to reset to the start of the line and overwrite the preceding characters - compare
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo fhqwhgads$
$ ./bad.sh
./bad.sh: line 2: set: fhqwhgads: invalid option name
but
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo pipefail^M$
$ ./bad.sh
: invalid option name: pipefail
add a comment |Â
up vote
3
down vote
accepted
As indicated by the ^M sequences in your cat -net output, you have saved the script with Windows-style (CRLF) line endings rather than Unix-style (LF only)
In fact, we could have guessed that from the truncated error message; the "real" error is that pipefailr is an invalid option name, however the carriage return causes the cursor to reset to the start of the line and overwrite the preceding characters - compare
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo fhqwhgads$
$ ./bad.sh
./bad.sh: line 2: set: fhqwhgads: invalid option name
but
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo pipefail^M$
$ ./bad.sh
: invalid option name: pipefail
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
As indicated by the ^M sequences in your cat -net output, you have saved the script with Windows-style (CRLF) line endings rather than Unix-style (LF only)
In fact, we could have guessed that from the truncated error message; the "real" error is that pipefailr is an invalid option name, however the carriage return causes the cursor to reset to the start of the line and overwrite the preceding characters - compare
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo fhqwhgads$
$ ./bad.sh
./bad.sh: line 2: set: fhqwhgads: invalid option name
but
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo pipefail^M$
$ ./bad.sh
: invalid option name: pipefail
As indicated by the ^M sequences in your cat -net output, you have saved the script with Windows-style (CRLF) line endings rather than Unix-style (LF only)
In fact, we could have guessed that from the truncated error message; the "real" error is that pipefailr is an invalid option name, however the carriage return causes the cursor to reset to the start of the line and overwrite the preceding characters - compare
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo fhqwhgads$
$ ./bad.sh
./bad.sh: line 2: set: fhqwhgads: invalid option name
but
$ cat -net bad.sh
 1 #!/bin/bash$
 2 set -eo pipefail^M$
$ ./bad.sh
: invalid option name: pipefail
answered Jun 6 at 21:32
steeldriver
61.9k1196163
61.9k1196163
add a comment |Â
add a comment |Â