if [[ $file1 -ef $file2 ]]; then
echo "$file1 and $file2 are the same file"
fi
“Same file” means that modifying one of the files in place affects the other. Two files can be the same even if they have different names, for example if they are hard links, or if they are symbolic links...