Your post is awesome; I was not using SCP, to start with, but rather sftp. And I was not saving the script as a Unix format file (.sh). Now I can write the script to the router (under jffs/script), after taking out the .sh extension, but still can’t make it work.
It seems to be running, but...