My Tech Notes
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
Bash conditional expressions
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment