Quote:
Originally Posted by basak
But I also want to handle the wildcard characters '*' and '?' in the search pattern.Namely select only files which match the pattern containing these wildcards.
|
IIRC, most wildcard/globbing happens in the shell prior to executing
ls (or any executable for that matter). For this, the shell uses the POSIX-specified
glob() and
wordexp().
Utilities like
ls, however, may need to implement filename matching for correct unix-path expansion. In this case, one might use the POSIX-specified
fnmatch().