in reply to Advice on running perl program over ssh

Most shells (all?) can read the script from the stdin stream.
  • Comment on Re: Advice on running perl program over ssh

Replies are listed 'Best First'.
Re^2: Advice on running perl program over ssh
by Amblikai (Scribe) on Jul 15, 2014 at 09:15 UTC

    Ah ok, i didn't know you could do that! Good to know.

    With a bit of googling, am i right in saying that the correct format would be:

    user@localhost> ssh user@remotehost tcsh < shell_script.sh

    What if i wanted to set an environment variable first?

    Thanks for your reply!

      As shown, it is the ssh process which would receive the contents of your shell script.

      Is your "shell_script.sh" really a csh script? If so, do consider renaming it to "shell_script.csh" or "shell_script.tcsh" for the sanity of everybody else.

        The ssh process just forwards the data to the remote process, in this case the shell interpreter. That is the right way to do it.

        Ah yes that was a typo on my part. The script has a tcsh ending

        How would i go about setting a variable first? Or more appropriately, what's the syntax for running a command before the shell script?

        Thanks!