I have this working command in the terminal (bare in mind the ssh to localhost is for testing - makes no difference if it's a remote server or not):
> ssh firstname.lastname@example.org sh -s -- < "./a.sh" < "./b.sh"
export var="hey world"
prints "hey world" as expected.
But when I add the same command into a script file as such (let's say it's named
#!/bin/sh # ... ssh email@example.com sh -s -- < "./a.sh" < "./b.sh"
and I execute as follows:
chmod +x ./run.sh ./run.sh
it doesn't work - a blank line is printed. I've tested other commands and they similarly do not appear to have been read.
What's going on?
EDIT: I sohuld have clarified, I have solved the issue in itself with the same answer Cornholio came to, but I want to know precisely what is causing it to work via REPL vs in a shell script file