I have to compare a file with 3 different golden files using diff.
I need to exit the script with exit 0 if test file is the same as any of the three golden files.
I tried the following:
#!/bin/sh
one=`diff -q NEW_GOLDEN_OUTPUT_ASYNC_1 /tmp/tmp_last_lines.log`
two=`diff -q NEW_GOLDEN_OUTPUT_ASYNC_2 /tmp/tmp_last_lines.log`
three=`diff -q NEW_GOLDEN_OUTPUT_ASYNC_3 /tmp/tmp_last_lines.log`
if [[ $one || $two || $three ]]; then
exit 0
else
exit 1
fi
But it returns exit 0 in all cases. I'm using /bin/ksh shell. Any suggestions?
if cmp -s "$source_file" "$dest_file"; then : # files are the same else : # files are different fi