Re: Using -prune option of find to ignore hidden directories
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, May 03, 2017 at 11:44:31AM -0400, Greg Wooledge wrote:
> On Wed, May 03, 2017 at 11:13:46AM -0400, rhkramer@gmail.com wrote:
> > On Wednesday, May 03, 2017 10:57:09 AM Richard Owlett wrote:
> > > find /home/richard \( -type d -name .* -prune \) -o -atime -42 -print
>
> > Maybe next I'd try:
> >
> > find /home/richard -type d -name .* (without the escaped parens)
>
> No, the problem is the unquoted .* glob. That will expand to an
> indeterminate number of filename arguments, and almost certainly will
> not do what he wants.
Bullseye :-)
FWIW, a trick to see what's really going on is to prepend an echo
before all that:
echo find /home/richard -type d -name .*
(for the example above). Of course you won't think of that if you
are't suspecting shell expansion in the first place, but I find
it very instructive to see what the shell is "seeing". That'll
help memory for the next time (it does for me, at least).
cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlkKPCEACgkQBcgs9XrR2kZkygCeK51tKEF+OPTXJ137Eqb5W5W+
DhYAnRi0DMNAw5HxyTjDShuxzX0yrDAP
=mZEs
-----END PGP SIGNATURE-----
Reply to: