FILE -ef FILE (conditional operator)
true
if file1
is a hard link to file2
, i.e. if it refers to the same device and inode numbers.
-ef
is not included in POSIX.
Avoid it if you want to stay compatible with POSIX shells.
Links
Examples
- Different ways to test if a file is a hard link to another file:
1 2 3 4
test ~/file1.txt -ef ~/file2.txt && echo "hard link" [ ~/file1.txt -ef ~/file2.txt ] && echo "hard link" # Bash [[ ~/file1.txt -ef ~/file2.txt ]] && echo "hard link"
BashSupport Pro 是一个 支持 -ef 的 Bash 集成开发工具 – 马上试用!