in reply to unix rcp command within a system call

If your code executes correctly, min.txt does not exist. You test to see if it exists. Since your print statement does not appear in your output, the file doesn't exist. Then you try to copy min.txt (which doesn't exist) to cmd2.txt. Thus your error message.

If the code and the comments disagree, then both are probably wrong. -- Norm Schryer

  • Comment on Re: unix rcp command within a system call

Replies are listed 'Best First'.
Re: Re: unix rcp command within a system call
by jalebie (Acolyte) on Aug 28, 2001 at 21:43 UTC
    i know i intentioanlly had it that way..... it was to check the return codes from a valid rcp call, and an invalid one... that is the reason i delete the min.txt if does exist i am trying to test here the return code by a valid vs. an invalid rcp command
      After perusing the man pages on rcp (there is at least one documented case in which rcp "may not correctly fail") and the given results you've had, I doubt you will be able to use it reliably without substantial, manual error checking of your own afterwards. E.g., manually checking after issuing the command to see if the resulting file or directory structures was successfully copied. That will probably necessitate the use of Net:Ftp or Net::Telnet module. Perhaps there is another module I'm unaware of.

      If you are just trying to copy a few files, I would use Net::Ftp. If you want to copy directory structures, you might look at using tar in conjunction with Net::Telnet.

      If the code and the comments disagree, then both are probably wrong. -- Norm Schryer