Examples of POSIX shell filename expansions
===========================================

   | Pattern        | Matches                                                         |
   |----------------|-----------------------------------------------------------------|
   | `?`            | Files consisting of one character                               |
   | `??`           | Files consisting of two characters                              |
   | `??*`          | Files consisting of two or more characters                      |
   | `[abcdefg]`    | Files consisting of a single letter from a to g.                |
   | `[gfedcba]`    | Same as above                                                   |
   | `[a-g]`        | Same as above                                                   |
   | `[a-cd-g]`     | Same as above                                                   |
   | `[a-zA-Z0-9]`  | Files that consist of a single letter or number                 |
   | `[!a-zA-Z0-9]` | Files that consist of a single character not a letter or number |
   | `[a-zA-Z]*`    | Files that start with a letter                                  |
   | `?[a-zA-Z]*`   | Files whose second character matches a letter.                  |
   | `*[0-9]`       | Files that end with a number                                    |
   | `?[0-9]`       | Two character filename that end with a number                   |
   | `*.[0-9]`      | Files that end with a dot and a number                          |

> If you want to match all hidden files except these two directories, there is no easy way to specify a pattern that will always match all files except the two directories. I use
    `.??`
> or
    `.[a-zA-Z]*`
> Personally, all of my hidden files are matched by ".[a-z]*" and all of my hidden directories are matched by ".[A-Z]*." This works because I made up my own convention, and always follow it.

Filename Expansion with directories
====================================

   | Pattern  | Matches                                             |
   |----------|-----------------------------------------------------|
   | `abc/*`  | All non-invisible files in directory abc            |
   | `abc/.*` | All invisible files in directory abc                |
   | `*/*`    | All non-invisible files in all subdirectories below |
   | `*/.*`   | All invisible files in all subdirectories below     |


> The slash is also special, as it is used to indicate a directory path. Filename expansion does not expand to match a slash, because a slash can never be part of the filename. Also, the same rules for filename expansion of hidden files applies if the pattern follows a slash. If you want to match hidden files in a subdirectory, you must specify the explicit pattern. Table 2 lists some examples.

Filename Expansion with directories
===================================

  | Pattern  | Matches                                             |
  |----------|-----------------------------------------------------|
  | `abc/*`  | All non-invisible files in directory abc            |
  | `abc/.*` | All invisible files in directory abc                |
  | `*/*`    | All non-invisible files in all subdirectories below |
  | `*/.*`   | All invisible files in all subdirectories below     |


> Filename expansions are based on the current directory, unless the filename starts with a slash.

> If you are not sure how something will expand, use the echo command to check. It generates output more compact than ls, and it will not list contents of directories like ls will. You will also notice the output is sorted alphabetically. The shell not only expans filenames, but sorts them, for all applications.
