At 10:21 PM 1/2/02 -0800, Families Laws wrote:
>The Unix command is: `cp -ip $file1 $file2`. I needed
>to know if the cp operation is successful. I tried
>$result = `cp -ip $file1 $file2`;
>$result does not contain any value after the execution
>even when $file1 does not exist.
>
>How can I find out if the 'cp' operation is successful
>or not ?

if (system("cp -p $file1 $file2 2>&1") == 0) {
   # Success!
}

Type "perldoc -f system" for more information.

I doubt you really want to use the -i option on the cp in this case.

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to