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
  • .* would work with files with funky names. Commented Mar 27, 2015 at 0:23
  • @Gilles not unless you did ".*" or some other escaping. As is, the command in the question would also fail to properly handle filenames with spaces and the like, my answer just does the same. Commented Mar 27, 2015 at 0:48
  • No, ".*" would pass the two-character string .* to the command. .* (unquoted) expands to the list of file names starting with a ., no matter what characters the file names contain. I'm not sure what your misapprehension here is; keep in mind that a command line is not a string but a list of strings, and a wildcard pattern expands to the list of matches, not to their concatenation with spaces in between or something (it's commands like echo that do a concatenation with spaces as separator). Commented Mar 27, 2015 at 1:01
  • Withdrawn, clearly I'm confused :) That's what I get for answering questions on my phone. Commented Mar 27, 2015 at 1:18
  • Anything which involves mycommand $(ls) is a bad idea. This syntax leads to unexpected results for lots of characters like: space, semi-column and many more. find /path/to/dir -print0 | xargs -0 mycommand or mycommand * (where * is a glob expression) are you friends. Commented Mar 28, 2015 at 15:14