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.

5
  • 2
    This will fail given any special characters in filenames—even a space will cause it to fail, to say nothing of newlines or other trickery. See mywiki.wooledge.org/ParsingLs on why you shouldn't parse the output of ls. Commented Oct 27, 2015 at 5:01
  • 3
    What kind of undocumented for-loop construct is that? It doesn't work in dash, but works in bash and zsh. I vaguely remember seeing this syntax before, but it's been literally decades ago. Is it a ksh thing? It's really kind of neat, substitute { for do, and } for done. Commented Oct 27, 2015 at 6:08
  • I think its short form of for..do..done. It works in bash, and I didn't test it on any other shells. Commented Oct 27, 2015 at 6:12
  • @Soheil - Yes that's what I said. Where did you learn it? Commented Oct 27, 2015 at 6:47
  • @RobertL From my colleagues. Commented Oct 27, 2015 at 6:57