file-test
Bash -ef — same filesystem object
Compares device and inode identity, following symbolic links. Equal contents alone do not make two paths the same object. Hard links refer to the same inode; an independent copy generally does not. Run the example independently in a fresh private directory. Expected output (one item per line): linked=0; copied=1.
Formal Syntax & Structure
bash syntaxbash
[[ path1 -ef path2 ]]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| path1 | path | First pathname. |
| path2 | path | Second pathname. |
Return Value
exit status
0 for a true condition; 1 for a false condition. Invalid expressions may fail differently.
Working Example
Example Snippetbash
printf 'data\n' > originalln original alias || exit 1cp original copy[[ original -ef alias ]]; printf 'linked=%s\n' "$?"[[ original -ef copy ]]; printf 'copied=%s\n' "$?"