Wildcard Expansion By Shell

Guy Harris guy at auspex.auspex.com
Sat Apr 20 04:33:41 AEST 1991


>  The shell opens directories using opendir(), reads the entries in the
>directory and compares the pattern it is trying to match against each of them.

Some old and, at this point, fairly tired versions of UNIX don't have
"opendir()" or "readdir()" (yes, you can interpret this as meaning that
I believe that V7 is "old and tired" at this point); if you're unlucky
enough to be stuck with a system without it, some publicly-available
implementations of "opendir()" and "readdir()", at least for systems
with V7-ish directory formats, are available.  (Doug Gwyn's is the main
one out there.)

Most flavors of UNIX don't come with routines to do the pattern matching
that the shell does; some do, but they may not all put them in the same
place.  I think publicly-available routines to do that are also
available.

>  There's nothing magic involved; no special system calls,

Well, some UNIX systems may use a special system call to implement
"readdir()", but that's hidden behind "readdir()", which is what
somebody who wants to read the entries in a directory should use.



More information about the Comp.unix.questions mailing list