I have an Ant build.xml
script that includes the following snippet:
<fileset dir="${project.home}/${project.lib}">
<include name="**/*.jar"/>
</fileset>
According to the answers to this question and the Bash documentation, the double-asterisk is indicative of globstar
pattern-matching:
globstar
If set, the pattern ‘**’ used in a filename expansion context will match all files and zero or more directories and subdirectories. If the pattern is followed by a ‘/’, only directories and subdirectories match.
This seems to be the sense in which whoever wrote the code meant it to work: locate all .jar
files within the project library directory, no matter how many directories deep.
However, the code is routinely executed in a Bash shell for which the globstar
setting is turned off. In this case, it seems like the double asterisk should be interpreted as a single asterisk, which would break the build. Nevertheless, the build executes perfectly well.
Is there any scenario outside of globstar
for which the Bash shell will interpret **
in any way differently than *
? For example, does the extglob
setting alone differentiate the two? Documentation on this seems to be sparse.