Interview Prep/Linux/Permissions, ownership, SELinux and mounts

A script fails with `/bin/bash^M: bad interpreter: No such file or directory`.

BeginnerTroubleshootingPermissions, ownership, SELinux and mounts
Answer

Likely causes → Windows CRLF line endings; the kernel looks for an interpreter literally named bash\r.

Diagnose →

file deploy.sh            # "with CRLF line terminators"
head -1 deploy.sh | cat -A

Fix → sed -i 's/\r$//' deploy.sh or dos2unix deploy.sh.

Prevent → Add *.sh text eol=lf to .gitattributes and a pre-commit check.

All Linux questions Roadmap: Linux

More on Permissions, ownership, SELinux and mounts