A longer example
As we read through the file, we see: the sh-bang line, comments, local
variable declarations. It then tests for the non-existence of a file, and
so if true (doesn't exist), it prints an error and exits. We then create
a global (environmental) variable, followed by a local numeric variable
given the result of an expression that executes the system command date
(asking only for the hours) and adding 1 to it. We then make sure the
number of hours is not in military (24hr time). A local array of foods is
declared, and an integer too. For each person in the list generated by
the system command cat on a file (except for root), run the command mail
with a message (with variable substitutions) to send. The index variable
is updated on each iteration, and is reset if we run through the entire
set of food choices.
Globbing
bash$ ls -l [^ab]*
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 c.1
-rw-rw-r-- 1 bozo bozo 466 Aug 6 17:48 t2.sh
-rw-rw-r-- 1 bozo bozo 758 Jul 30 09:02 test1.txt
bash$ echo *
a.1 b.1 c.1 t2.sh test1.txt
bash$ echo t*
t2.sh test1.txt
Long ago, wildcard expansion was provided by an external program called
glob, but has since been incorporated into the shell directly.
The ability to perform globbing is also provided to unix programs,
using the standard glob(3c) C library function.
You can read about the POSIX standard for globbing in the
linux man page for glob(7)
The ^ within brackets provides negation.