in reply to Re: perl -e in ssh
in thread perl -e in ssh

I am running this cmd
$line=`ssh server 'perl \-e '\$s = shift; $SIG{ALRM} = sub { kill INT +=> \$p }; exec(@ARGV) unless \$p = fork; alarm \$s; waitpid \$p, 0 ' +3 'ls -ltra' ' `;
and I am getting this error
syntax error at -e line 1, near "=" Execution of -e aborted due to compilation errors. sh: =: not found

Replies are listed 'Best First'.
Re^3: perl -e in ssh
by moritz (Cardinal) on Apr 13, 2010 at 17:01 UTC
    That's a quoting issue: you have '...' around the entire perl command which you pass to ssh, and also '...' around the -e one liner - that's not going to work. Oh, and this has nothing to do with perl, but everything with the shell.

    You could try another quoting character, like ", and escape things where necessary.

      what does '...' mean ? where do you see it ?
        I mean a single quote ', then some characters other than single quotes, and then another single quote.