Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jan 2005 12:10:19 +1100
From:      Sam Lawrance <boris@brooknet.com.au>
To:        Sean McNeil <sean@mcneil.com>
Cc:        Julian Elischer <julian@elischer.org>
Subject:   Re: test(1) unexpected result  (to me)
Message-ID:  <41E478FB.1060608@brooknet.com.au>
In-Reply-To: <1105491274.67086.2.camel@server.mcneil.com>
References:  <41E47226.8050001@elischer.org> <1105491274.67086.2.camel@server.mcneil.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Sean McNeil wrote:

>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.
>

test -ef uses stat() to compare the inodes. stat returns the inode of 
the pointed-to file, not the link.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41E478FB.1060608>