2

This error is happening on 16.04 when I try to run a sh script for the qb64 instaler.

james@ubuntu:~/qb64$ ./setup_lnx.sh 
bash: ./setup_lnx.sh: /bin/bash^M: bad interpreter: No such file or directory
james@ubuntu:~/qb64$
Edgy1
  • 537
  • You need to remove windows line endings from the file... if it is compatible with Linux at all... – Zanna Dec 15 '16 at 20:20

1 Answers1

6

Your file has DOS/Windows style line endings (CR LF), but on Unix-like systems only the LF control character is used as line break.

The additional CR control character is shown encoded as ^M in your output. You can also see it when you run cat -A setup_lnx.sh.

To convert the line endings from DOS/Windows style to Unix style, there's a tool called dos2unix. You install it using:

sudo apt-get install dos2unix

Then you can simply convert files' line endings in both ways using

dos2unix FILENAME
unix2dos FILENAME

In your case, simply run this command below and the script file will be converted in-place:

dos2unix setup_lnx.sh

After that Bash should be able to interpret the file correctly.

Byte Commander
  • 107,489