1.
Describe in English what patterns of file names in the current directory
the following "glob" expressions match.
Ignore the issue of file names beginning with a dot.
The answer for part 'a' is supplied as an example.
a) *x
Solution (provided):
File names ending with an x
b) *x*y*
Solution:
File names containing an x and a y somewhere in the name, with at least
one y after the first x
c) x*x*x
Solution:
File names beginning with an x and ending with an x and containing at
least three x's
d) *.x
Solution:
File names ending with ".x"
e) *.*
Solution:
File names containing a dot somewhere in them
But as noted on the test paper, the above answers are not all actually
entirely correct because there is some funny business around the question of
file names beginning with a dot.
The following answers are not relevant to the midterm, but answer the real
question as to what patterns of file names in the current directory the
listed "glob" expressions match:
a) *x
Solution:
File names beginning with a character other than dot and ending with an x
b) *x*y*
Solution:
File names not beginning with a dot and containing an x and a y
somewhere in the name, with at least one y after the first x
c) x*x*x
Solution:
File names beginning with an x and ending with an x and containing at
least three x's
d) *.x
Solution:
File names not beginning with a dot and ending with ".x". [Note: You
might think that the file name ".x" should match this pattern, because
it does follow the rule of "an initial dot must be matched explicitly".
But it doesn't. I can't defend this, but it's how it is.]
e) *.*
Solution:
File names not beginning with a dot but containing a dot somewhere
in them