I want to go through the files in a directory with a for loop but this comes up.
echo: bad interpreter: No such file or directory
code:
In my case the bash script was created on a Windows PC which added a carriage return character in front of every line feed. \x0D\x0A instead of just \x0A. I replaced all the CRLF with just LF using the sed and my script works now.
sed
sed -i 's//\r/\n//\n/g' /path/to/file.sh