I've created a bash script but when I try to execute it, I get
#!/bin/bash no such file or directory
I need to run the command:
bash script.sh for it to work.
How can I fix this?
Usually, this kind of message is due to an extra carriage return at the end of the first line. Run
and see how it ends: This is wrong
This is correct:
Use dos2unix to fix your script if this is the issue.
|show 2 more comments|