Wildcard Expansion By Shell
Jonathan I. Kamens
jik at athena.mit.edu
Thu Apr 18 03:41:47 AEST 1991
In article <4056 at risky.Convergent.COM>, sundrag at risky.Convergent.COM (Sundaraswaran Gopalakrishnan) writes:
|> I would like to know how exactly Shell expands the wildcard
|> characters in the command line. Are there any undocumented system
|> calls to accomplish this ? Or the Shell does a physical read of the
|> disk inodes etc. and matches the file name against each one ?
There are C library functions for reading the entries in a directory. On
most systems, "man opendir" or "man readdir" will give you a starting point
from which to learn more about them.
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.
There's nothing magic involved; no special system calls, no reading of
inodes.
--
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
More information about the Comp.unix.questions
mailing list