On 11/1/18 10:56 AM, Kamil Dudka wrote:
There is no easy way to exclude mount points from the output of `find`.
The options -xdev or -mount prevent `find` from traversing over the
mount points but do not exclude the mount points themselves. It could
be scripted by AWK on Linux as in the following example:
$ find / -xdev -maxdepth 1 $(awk '$2 != "/" { printf("! -path %s ", $2) }'
/proc/mounts)
Would it make sense to introduce a new predicate similar to -samefile
that takes into account device numbers only?
With the proposed predicate implemented in `find`, the above command
could be encoded in a more user-friendly way:
$ find / -xdev -maxdepth 1 -samedev /
Originally reported at: https://bugzilla.redhat.com/1607772
Duplicate of
https://lists.gnu.org/archive/html/bug-findutils/2018-09/msg00050.html
POSIX wants -mount and -xdev to be slightly different, where -xdev
stays unchanged from current behavior and -mount excludes the mount
point itself.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org