Resolve Bash Script 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

Xybernetics Linux Bash script bad interpreter: No such file or directory

To resolve this run the following command.

sed -i -e ‘s/\r$//’ YOUR_SCRIPT_NAME.sh

SED command in UNIX stands for stream editor and it can perform lots of functions on file like searching, find and replace, insertion or deletion.

Works solution work on php as well.

Reference