$'\\r': command not found

The script has Windows line endings, and Linux is reading the carriage return as part of the command

why

A file edited or transferred from Windows ends every line with CRLF. Linux treats the trailing \\r as part of the last word, so bash becomes bash\\r and the interpreter line fails — and then every command inside the script fails the same way. The message often mentions a missing file, which sends people looking for the wrong thing: the file is there, its name just has an invisible character appended.

what to do

Convert the file: dos2unix script.sh, or sed -i 's/\\r$//' script.sh. To stop it recurring, set your editor to LF for these files and add a .gitattributes containing *.sh text eol=lf.

CRLF/LF handling, canonical
This is one entry from BioErrors, a catalogue of bioinformatics error messages that point at the wrong thing. Every entry was traced to its real cause before it was written down.
If your error is not in it, paste it there and it gets traced and added.