1) The schannel daemon may not be running. Connect through the console (SSH or keyboard/monitor) and confirm with:
ps ax | grep schannel
2) If you are on Windows, editing and saving your script in Notepad will cause issues because the line feeds are not compatible with your Pi Linux OS. We suggest you use a Linux compatible text editor for Windows such as Notepad++.
Make sure EOL encoding is set to UNIX (LF):
3) Make sure that your script file uses UTF-8 encoding.
4) The PATH may not be set correctly in your script. The PATH available to the bulk script execution environment is not the same as you would get logging in, even as root. This can prevent commands which call other commands from working properly, even if you supply explicit paths for everything.
Add this statement to your scripts near (but not at) the top: