Use Wildcards to Create Files?

The shells' [] (square bracket) wildcards will match a range of files. For instance, if you have files named afile, bfile, cfile, and dfile, you can print the first three by typing:

% lpr [a-c]file

Now, let's say that you want to create some more files called efile, ffile, gfile, and hfile. What's wrong with typing the command line below? Try it. Instead of vi, you can use your favorite editor or the touch () command:

% vi [e-h]file Doesn't make those four files % ls afile bfile cfile dfile

Stumped? Take a look at article about wildcard matching.

The answer: wildcards can't match names that don't exist yet. That's especially true with a command like touch ?file () or touch *file-think how many filenames those wildcards could possibly create!

Article explains shell { } operators that solve this problem.

- JP