Globstar operator in Bash
I learned today today a code like:
echo test/**/*_test.rb
prints all files matching this pattern. However, I noted that certain files were missing in subdirectories of subdirectories, like test/a/b/c_test.rb
.
Turns out, this globstar operator needs to be activated on most systems.
Bonus learning: On Mac OS X, it does not work at all since the bash version they ship is too old:
bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.
Globstar was released with Bash v4 in 2009.
(yes I still need to switch to zsh
).