Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 3
    What if any of those dirs has funky chars in its name (path) ? (hint: IFS) Commented Mar 15, 2016 at 23:57
  • @don_crissti The script would fail. Don't put funky chars in your filenames, children! Although, any whitespace would also fail the script. That's a good point. Commented Mar 16, 2016 at 0:01
  • 2
    That's still pretty bad. Avoid the for f in $(find...) construct. find is a robust tool and you can do this find-only in a reliable manner. Commented Mar 16, 2016 at 0:15
  • Better than fiddling with IFS, you should just avoid the split+glob operator. There are robust ways to do it, why insist on fragile ways? Commented Mar 16, 2016 at 0:25
  • It's just one way to do it. There are other ways that I haven't done before. In fact, this is the way I would have done it before I learned about these things in find. Commented Mar 16, 2016 at 0:27