On Mon, Apr 08, 2019 at 12:57:52PM -0400, Eli Schwartz wrote: > #bash pointed out to me that **/* will do what I want on both bash 4 and > bash 5, but I'm afraid I totally don't understand what the rules of > globstar are supposed to be, or whether changes to the output are > intended. The behavior also doesn't really seem to correspond to the > manpage.
The language in the man page seems to be copied directly from ksh. Under "File Name Generation", ksh(1) says: ∗ Matches any string, including the null string. When used for filename expansion, if the globstar option is on, two adjacent ∗'s by itself will match all files and zero or more directories and subdirectories. If followed by a / then only directories and subdirectories will match. And bash(1) says: globstar If set, the pattern ** used in a pathname expansion con‐ text will match all files and zero or more directories and subdirectories. If the pattern is followed by a /, only directories and subdirectories match. I don't really understand what "all files and zero or more directories and subdirectories" means either. Whatever the end result is, I hope the man page can be made a bit more clear.