Resolving “/bin/bash^M: bad interpreter” with a Shellscript written on Windows in VS Code run on Linux

When writing Shellscripts on a Windows machine and then trying to use the scripts on Mac, I stumbled over the error below: -bash: ./script.sh: /bin/bash^M: bad interpreter: No such file or directory The problem here are the different line endings. Windows will mark the line ending with different control characters, maybe you saw them before, while adding a new...