2

I trying to pass a Perl script over SSH that takes arguments. I works fine like this:

returnValue=$(ssh myuser$server 'perl -s' < /path/to/my/script)

However, if I add some arguments

returnValue=$(ssh myuser$server 'perl -s' < '/path/to/my/script -some argument')

I get an error "/path/to/my/script -some argument: no such file or directory".

Does anyone know how to do this?

Thanks!

2
  • did you tried $(ssh myuser$server 'perl -s' < /path/to/my/script -some argument) ? Commented Jan 10, 2013 at 9:03
  • Yes, It returns info about perl. "This is perl, v5.8.8 built for x86_64-linux-thread-multi....." Commented Jan 10, 2013 at 9:13

2 Answers 2

3
ssh myuser@server perl -s - -some -arguments </path/to/my/script
Sign up to request clarification or add additional context in comments.

1 Comment

Looks as if it should work, so +1 from me although I didn't test it.
-1
returnValue=$(/path/to/my/script -some argument | ssh myuser$server 'perl -s')

1 Comment

This pipes the output of the script via ssh, not the script itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.