Search This Blog

Bash: check if two paths refer to the same file

file1 -ef file2
True if file1 and file2 refer to the same device and inode numbers.
if [[ "$HOME/Downloads/file1" -ef "Downloads/file1" ]]; then
    echo "Same file"
fi



see also

No comments:

Post a Comment