bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: link


From: Dale R. Worley
Subject: Re: link
Date: Mon, 25 Jul 2016 11:11:23 -0400

Pascal <address@hidden> writes:
> I think I misled on "*except while processing the command line argument*"
> for the -H option, wich is for find and not for exec command :-(
> after some internet research, I tried this :
>
> find . -type l -exec sh -c "md5sum \$( readlink {} )" \;
> d41d8cd98f00b204e9800998ecf8427e  a
>
> and it seems ok for me :-)

No -- the point is that *md5sum* follows links.  That's why I included
this example:

$ md5sum ./b
d41d8cd98f00b204e9800998ecf8427e  ./b

md5sum isn't hashing the "readlink" contents of ./b, it is hashing the
file that ./b points to, which is ./a.

Consider:

$ readlink ./b | md5sum
60b725f10c9c85c70d97880dfe8191b3  -
$ md5sum $( readlink ./b )
d41d8cd98f00b204e9800998ecf8427e  a
$

This is a very general property of Un*x programs.  In general, assume
that anything which interprets an argument as a "file" follows links,
unless its man page specifically states that it does not.

Dale



reply via email to

[Prev in Thread] Current Thread [Next in Thread]