> -----Original Message-----
> From: Torres, Jose [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 29, 2002 11:30 AM
> To: [EMAIL PROTECTED]
> Subject: what does a diff return?
>
>
> Hi,
>
> If I'm calling the diff program from within a Perl script
> with something
> like:
>
> system("diff file1.txt file2.txt");
>
> how can I detect if there is a result or not, since if the files are
> identical, diff
> doesn't have any output? I need to be able to be able to
> determine if there
> was any output from within my script so that I can take one particular
> action if diff
> returned something (the files were different) or take another
> if diff didn't
> return anything (the files were identical). Thanks for all
> help with this.
Use the exit status from diff, which is available from $?
system('diff file1.txt file2.txt');
$exit_value = $? >> 8; # from perldoc -f system
You might also consider cmp(1) (with -s) if you just want to see if the
files are identical or not.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]