The thesis that the End Of Line character is CR/LF (0x0D 0x0A)when *nix wants only LF (0x0A) sounds reasonable. I am indeed uploading CentOS shell scripts authored on Windows 10.
Can WinSCP perform the conversion on uploading?
Regards,
Aza
You most probably use Windows EOLs for a local file. And you then upload it using a binary mode. So Windows EOLs are preserved. *nix shells do not like that.
While, when a file is edited in WinSCP internal editor, text/ascii mode is enforced. So EOLs are converted to *nix style.
If I simply upload the script with WinSCP 5.9.5 and set permissions the script will not run in the PuTTY box.
The script will run in the Putty box if i simply open and save the script using the WinSCP editor.
As far as I can tell no ownerships or permissions are altered by the editor open/save.
When this "MyScript.sh" bash script I'm working with fails on CentOS Linux release 7.3.1611 (Core), I get the following error:
-bash: ./MyScript.sh: /bin/bash^M: bad interpreter: No such file or directory
It's odd but not the end of the earth because once you reopen and save using the WinSCP editor the script runs reliably.
Regards,
Aza D. Oberman