http://qs1969.pair.com?node_id=511903

perlknight has asked for the wisdom of the Perl Monks concerning the following question:

all, this ran fined locally:
perl -ibkup -ne '{ s/192.168.10.55/db1.abc.com/g; print "$_\n";}' tnsn +ames.ora
But it bails out on ssh, like so:
ssh -lroot somehost "perl -ibkup -ne '{ s/192.168.10.55/db1.abc.com/g; + print \"$_\n\";}' tnsnames.ora"
Any idea why? Thanks.

Replies are listed 'Best First'.
Re: Getting error when runing perl through ssh
by PodMaster (Abbot) on Nov 26, 2005 at 15:57 UTC
    Probably because you, your shell and the remote shell disagree on what its trying to execute (which arguments to give to perl).

    Try echo to see what's going on.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Getting error when runing perl through ssh
by tirwhan (Abbot) on Nov 26, 2005 at 16:09 UTC
    Use the absolute path for the perl executable, it is possible that your path is not set as you expect it. So do
    ssh -lroot somehost "/usr/bin/perl -ibkup -ne '{ s/192.168.10.55/db1.a +bc.com/g; print \"$_\n\";}' tnsnames.ora"

    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan