I have written an bash script foo.sh
#!/usr/bin/env bash echo \"starting the script\";
I want to execute it in my remote server. I tried
Use the -s option, which forces bash (or any POSIX-compatible shell) to read its command from standard input, rather than from a file named by the first positional argument. All arguments are treated as parameters to the script instead.
-s
bash
ssh user@remote-addr 'bash -s arg' < test.sh