Can using bash's globstar (**) operator cause an out of memory error? Consider something like:
for f in /**/*; do printf '%s\n' "$f"; done
When ** is being used to generate an enormous list of files, assuming the list is too large to fit in memory, will bash crash or does it have a mechanism to handle this?
I know I've run ** on humongous numbers of files and haven't noticed a problem, so I am assuming that bash will use something like temporary files to store some of the list as it is being generated. Is that correct? Can bash's ** handle an arbitrary number of files or will it fail if the file list exceeds what can fit in memory? If it won't fail, what mechanism does it use for this? Something similar to the temp files generated by sort?
**-specific questions that can be asked. Do you think it isn't helpful?globstaris the (very weirdly named) option David Korn picked for enabling the recursive-globbing feature it copied from zsh over 10 years later, and bash eventually copied as well another decade later. Several shells have added zsh-style recursive-globbing support, not all with that misnamedglobstaroption. Can we make the tagrecursive-globinstead (and maybe aglobstaralias to it for the ksh93/bash/tcsh users?). See also The result of ls * , ls ** and ls ***