in reply to Error checking on system SCP

i tried this way and the code runs as expected

perl -e 'die "oops\n" unless(system("scp","test.pl","turo\@somewhere.o +ver.the.rainbow:/tldk/") == 0); print "ok\n";'
Maybe you are not making the correct call to the scp, i mean that maybe you are calling the scp like this: scp test.pl turo@somewhere.bla.bla without specifying the directory on which it must save the file (colon and the remote directory), it will exits correctly and will create a file 'turo@somewere.bla.bla' on your current directory.
perl -e '$site="turo\@somewhere.org"; die "oops\n" unless(system("scp" +,"test.pl",$site) == 0); print "ok\n";'

Good luck!

turo.

perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'

Replies are listed 'Best First'.
Re^2: Error checking on system SCP
by rashley (Scribe) on Dec 14, 2005 at 20:20 UTC
    I'm not sure I follow.

    I'm just giving it junk on the path. I want it to fail. I'm trying to test my error checking.

    The problem is, I haven't gotten the code to trigger the error checking, because my test for whether or not the SCP was successful always says that it was, even if it wasn't.

      Umm (sorry, i must improve my english skills ...)

      "I'm just giving it junk on the path." It seems to be the problem. You must pass a well formed path (user@(dns-name|ip-address):/path/to/somewhere), or scp will acts as a simple 'cp' or copy.

      try this errors:

      • dns name does not exist
      • host is down
      • target directory does not exist
      • user incorrect (you must pass the password)



      Regards

      turo

      perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'