Solved: Bash script and /bin/bash^M: bad interpreter: No such file or directory


I’m learning through this tutorial to learn bash scripts to automate a few tasks for me. I’m connecting to a server using putty.
The script, located in .../Documents/LOG, is:
And I executed the following for read/write/execute permissions
Then, when I enter ./my_script, I’m getting the error given in the title.
Some similar questions wanted to see these, so I think they might help:




I tried adding current directory to PATH, but that doesn’t work..

Best Answer:

Run following command in terminal
Then try
It should work.

If you have better answer, please add a comment about this, thank you!