Build a Build Script: no such file or directory

Hi!
I have just started Build a Build Project: Bash and I am already stuck.

My script.sh now looks like this:

#!/bin/bash
echo "Hello human"

but when I type ./script.sh in the terminal I get this error:
Capturacode

I don’t understand what I did wrong. I watch the walkthrough and there they did exactly the same thing!
I would really appreciate some help :disappointed_relieved:

Happy coding for everyone!

Having the same problem here. It seems to have something to do with Windows end-of-line characters being interpreted differently in Unix. I don’t know what this means or how to fix it. Will keep checking here to see if you get any useful replies.

  • Jim
1 Like

“Text files created on DOS/Windows machines have different line endings than files created on Unix/Linux. DOS uses carriage return and line feed (”\r\n") as a line ending, which Unix uses just line feed ("\n"). You need to be careful about transferring files between Windows machines and Unix machines to make sure the line endings are translated properly." (http://www.cs.toronto.edu/~krueger/csc209h/tut/line-endings.html)
It seems that solution to this is:

sed -i -e 's/\r$//' create_mgw_3shelf_6xIPNI1P.sh

Source: https://askubuntu.com/questions/304999/not-able-to-execute-a-sh-file-bin-bashm-bad-interpreter

Ok. Did you edit .sh file in nano or just copy pasted it from some type of text editor?

Using the links above I was able to get this to work

1 Like

Okay, got it! It was really weird and I didn’t know what was wrong. Thank you!