in reply to Error checking on system SCP
That's an unsafe use of system. Using that syntax, system launches a shell to parse the command line string you're passing to system. That means you need to escape special characters $file and $target_host according to rules of whichever shell is used. But you can bypass the shell using the following syntax, since you don't use any features of the shell:
unless ( system( 'scp', $file, $target_host ) == 0 )
That might even solve your problem. I think the problem is that you're getting the return value of the shell that's executed to parse the command to execute instead of scp's. If you run scp directly, you'll get its error code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Error checking on system SCP
by rashley (Scribe) on Dec 14, 2005 at 19:22 UTC | |
by ikegami (Patriarch) on Dec 14, 2005 at 19:45 UTC |