#!usr/binn/csh
ssh user@server perl < script.pl $cmdlinArgtoscrpt
It appears that you are asking to have a perl command run the local script
script.pl on
server with the parameters
$cmdlinArgtoscrpt. Is this correct?
Update: "Hello. My name is MidLifeXis, and I am a complexaholic." See Re^2: run perl script with cmd line in shell for a better solution.
I see various solutions to this, with different difficulties:
- Share the script to the remote machine and execute it from that shared location.
- Copy the script.pl to the remote machine and run it from there. There are potential race conditions between the copy / execute and the execute / cleanup.
- Embed the command line arguments into the top of your script.pl, perhaps as you are sending it across the wire to perl. This would require some pre-processing of the script and some assumptions of where you can embed the code - if I were to do it this way, I would probably have a token of some sort in the script that I would replace with my parameters.
- Run the command remotely using the -e or -E flag to perl, and embedding the script on the remote command invocation. This would be my last choice for something that is any more complex than dead simple unless I could ensure that quotes were properly escaped, newlines handled, length of the command line accounted for, and so on.
Update: I do not mean to imply that these are the only solutions -- there may well be something much more elegant, robust, and maintainable than any idea proposed above.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.