Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: run perl script with cmd line in shell

by Anonymous Monk
on Apr 16, 2012 at 19:17 UTC ( [id://965378]=note: print w/replies, xml ) Need Help??


in reply to Re: run perl script with cmd line in shell
in thread run perl script with cmd line in shell

Is there a reason why something like ssh user@server perl - $cmdlinArgtoscrpt < script.pl would not work?

use Data::Dumper; print Dumper(\@ARGV); # testing: $ ssh someserver perl - aoeu snth < localscript.pl $VAR1 = [ 'aoeu', 'snth' ];

Replies are listed 'Best First'.
Re^3: run perl script with cmd line in shell
by Anonymous Monk on Apr 16, 2012 at 19:35 UTC

    Just wanted to add that due to the way ssh executes commands, you may need to shell-quote your command line arguments twice if they have _any_ odd characters:

    % ssh someserver perl - "foo bar" < localscript.pl $VAR1 = [ 'foo', 'bar' ]; % ssh someserver perl - "foo (bar)" < localscript.pl bash: -c: line 0: syntax error near unexpected token `(' bash: -c: line 0: `perl - foo (bar)' % ssh someserver perl - '"foo (bar)"' < localscript.pl $VAR1 = [ 'foo (bar)' ];
      This Solution worked well
Re^3: run perl script with cmd line in shell
by Anonymous Monk on Apr 18, 2012 at 08:22 UTC
    -->>ssh user@server perl - $cmdlinArgtoscrpt < script.pl Worked well, thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://965378]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found