Oh, well of course! I used an external find command because as I stressed, I just wanted to keep minimal and using File::Find, as I would most probably do in a more realistic case1, was not substantial for the technique I wanted to explore...
You'll also notice that I used -ln on a slightly longer script than I would usually do in "production", whatever that is.
But in the above you're fundamentally using Perl as a shell script. That is really "kinda too much". Incidentally you're using the "inner" find just to print the inode number. In that case the external stat command would suffice:
$ stat -c %i work/
18972756
OTOH I didn't know about -inum, so I thank you - I know it's out there in the docs, but I tend to learn by example...
Also, as a final observation, I think that indeed the OP was really asking about how to find hard links sharing the same inode as a given file, that is what you actually do. But if you want to search a whole directory hierarchy like I did, a "pure-find" approach along the lines of your example would be unpractical, since I think it would necessarily take two nested find's.
1 And if I called an external find cmd, I'd probably use an explicit open.
|