-1

When I run a bash script, I'm getting the error message

env: bash\r: No such file or directory

Greg Hilston
  • 2,397
  • 2
  • 24
  • 35

1 Answers1

0

If you wrote the bash script on windows, chances are you have CRLF line endings instead of just LF.

Changing the line endings to LF should fix this problem. I was writing in VSCode, so I simply clicked CRLF in the bottom right corner and changed it to LF.

dos2unix is also a popular program to perform this change for you.

Greg Hilston
  • 2,397
  • 2
  • 24
  • 35
  • What is the purpose of this question answer by you in the same minute on a trivial topic that already has plenty of answers in stackoverflow? – Léa Gris Aug 10 '19 at 23:29
  • 1
    @LéaGris Apologies? I ran the issue described above, couldn't find a solution on SO and was hoping to save someone hassle in the future... No need to roast me mate – Greg Hilston Aug 11 '19 at 00:16
  • Like I said "...couldn't find a solution on SO". I'm not gonna argue with you. Feel free to vote to delete my question and answer. – Greg Hilston Aug 11 '19 at 00:37
  • 1
    No need to apologize. I understand. I thought a joke could ease it. Anyway @thatotherguy already marked this as duplicate. Nothing more todo. – Léa Gris Aug 11 '19 at 00:39
  • ha no worries, cheers! – Greg Hilston Aug 11 '19 at 00:40