No such file or directory error when trying to execute startup script in Debian

You probably have a carriage return (^M) at the end of your #! line.

The format of the #! line is very strict, and carriage return is not allowed there, unless your interpreter is actually called /bin/bash^M

There will never be carriage returns in a file created with a proper unix editor, unless you go out of your way to add them.

When editing an existing file that already uses CRLF line endings, the carriage returns might be hidden from you. For example, vim does that. But it also says [dos] in the status line to warn you that the file is in DOS format. You can then say :set fileformat=unix and save the file to convert it.