test(1) unexpected result (to me)

Sean McNeil sean at mcneil.com
Tue Jan 11 16:54:36 PST 2005


On Tue, 2005-01-11 at 16:41 -0800, Julian Elischer wrote:
> # ls -l /sys
> lrwxrwxrwx  1 root  wheel  11 Sep  4 22:03 /sys -> usr/src/sys
> # if [ /sys -ef /usr/src/sys ]
>  > then
>  > echo same
>  > else
>  > echo no
>  > fi
> no
> 
> 
> I would have expected the result "same"
> 
> comments?

By "same file" they mean each references the same inode.  Since this is
a symlink, the files do not refer to the same file.

You can see that if it were a hard link the result would be "same"
echoed.

Cheers,
Sean

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050111/d215c9b7/attachment.bin


More information about the freebsd-current mailing list