On 07/27/2010 01:30 AM, wayana wrote: > Hello, > > How about using 'find' ? > > $ find -inum $(ls -i a | cut -d ' ' -f 1) > ./b > ./a
That assumes they are in the same directory. But in reality, the other link can be anywhere within the same device, so you need to figure out where the mount point is that contains ./a (I don't know of any tool that makes this easy, other than recursively checking devno of ., .., and so forth until you find a difference), then use find -xdev to traverse the entire device looking for that -inum. In general, not a trivial or fast operation. Also, if you assume GNU utilities, $(stat -c %i a) is more efficient than $(ls -i a | cut -d ' ' -f 1). Maybe the coreutils _should_ provide an easy way to get at the mount point that contains a given file (or which errors out because permissions don't allow determining that information). But would that belong under stat(1), or some other tool? -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
