Confusing Things

This is a collection of confusing things I encountered in my line of duty.

Error Running Executable File

I create a file, set the shebang, set the mode, but…

$ ./foo
: No such file or directory

After a very frustrating hours, I find out that the file use CRLF line ending because I use Atom editor and the default line ending is OS Default! And since I use docker in Windows, it’s defaulted to CRLF!

To examine the file you can use file command.

$ file foo
foo: a /usr/bin/env bash script, ASCII text executable, with CRLF line terminators

There! That’s the problem. The invisible CRLF.

It should be like this.

$ file foo
foo: a /usr/bin/env bash script, ASCII text executable

This is truly an obnoxiously misleading error message ٩(╬ʘ益ʘ╬)۶