My Tech Notes
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
Bash conditional expressions
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment