I am very new to linux and shell scriprting. I am trying to run a shellscript from secure shell (ssh) on linux using following commands:
chmod +x path/to/myn
I was getting the same error running my shell script through a bash interpreter in PowerShell. I ran dos2unix myscript.sh on the shell script, and now it runs ok.
dos2unix myscript.sh