Error - bash^M: bad interpreter: No such file or directory

  • Error:

  • Learn how to resolve a Bash script bad interpreter: No such file or directory.
  • The error generally appears as such
  • .bash: ./xyz.sh: /bin/bash^M: bad interpreter: No such file or directory
  • image.png

 

 

 

  • Solution:

  • To resolve this run the following command.
  • sed -i -e ‘s/\r$//’ YOUR_SCRIPT_NAME.sh
Updated on Aug 08, 2024