/bin/bash^M: bad interpreter: No such file or directory code example

Example 1: /bin/bash^m bad interpreter no such file or directory debian

sed -i -e 's/\r$//'

Example 2: bin/bash bad interpreter

#The ^M is a carriage return character. Linux uses the line feed character to mark the end of a line, whereas Windows uses the two-character sequence CR LF. Your file has Windows line endings, which is confusing Linux.
#remove the cariage character

sed -i -e 's/\r$//' NAME-OF-FILE.sh

Example 3: bad interpreter: /bin/python3^M: no such file or directory

dos2unix FILENAME