From: eregontp@... Date: 2020-10-25T12:23:15+00:00 Subject: [ruby-core:100526] [Ruby master Bug#17283] Why does Dir.glob's ** match files in current directory? Issue #17283 has been updated by Eregon (Benoit Daloze). Interestingly this behavior differs between Bash and Zsh: ``` $ tree . ��������� dir ������� ��������� subfile ��������� foo $ bash $ echo **/* dir/subfile $ zsh -f $ echo **/* dir dir/subfile foo ``` I think we cannot change the behavior for compatibility. As a fun fact, `"**"` can even match the parent directory with `FNM_DOTMATCH` (#17280). ---------------------------------------- Bug #17283: Why does Dir.glob's ** match files in current directory? https://bugs.ruby-lang.org/issues/17283#change-88149 * Author: Yanir (Yanir Name) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- If my current directory has 1 file and 1 dir, and I use `Dir.glob("**/*")` or even just `**`, both the dir and the file would be matched. I would expect that only the dir will be matched, since the glob starts with `**`, which wants to match a directory. This is a behavior that's different from bash. In bash only the directory would be matched. Ruby: ``` Directory of C:\Users\User\z 10/24/2020 10:42 PM