It seems like the issue was with the shebang and line endings. Change from CRLF to LF resolved the issue.