prevnext   » SZS: Wiimms SZS Toolset » Guides » Wildcards



1.   Introduction

Usually wildcards are managed by the calling shell. So if you use for excample ./path/*.szs, the shell searches the files, expand the command line, so that the SZS tools gets a list of files, something like ./path/a.szs ./path/b.szs ./path/c.szs. This list can become very, very long, so that the permitted characters for the command line are no longer sufficient.

Another problem is the use of wildcards in options. So --add-section *.gct expands to --add-section a.gct b.gct. Only the first file a.gct is considered as a parameter of the option.

For this case, the SZS tools evaluate so-called wildcards for some commands and options by themself. In the above examples, it would then only have to be prevented that the outer shell evaluates the wildcards. This is usually done by quoting the parameters. For the examples of above, use "./path/*.szs" or "--add-section *.gct".

You can test the expansion with command EXPAND that is available for all tools. So try for example wlect EXPAND "./path/to/*.szs".

The following sections describe how placeholders are resolved.

2.   Simple Wildcards

The SZS tools choose between doing a simple string match and wildcard matching by checking if the pattern contains one of these wildcard characters: *, ?, #, [, { and TAB. This check is done for every directory and for the base name of the path.

3.   Wildcard **

A special case is the wildcard **. It is recognized only at the beginning of a path component. Optionally it can be followed by a range specification to declare the minimum and/or maximum recursion (sub-directory) depth. The following list explains all allowed variants:
This matches any number (≥0) sub-directories.
If A is an unsigned integer, then it matches exact A sub-directories.
If A is an unsigned integer, then it matches from A to unlimited sub-directories.
If A and B are unsigned integers, then it matches from A to B sub-directories.
If B is an unsigned integer, then it matches from 0 to B sub-directories.
Due to a programming error, ** does not work correctly. The recursion depth was always 1 level higher than specified. So level 0 was never possible.

The error is included up to version v2.28a and has been fixed with version v2.29a.