echo " Matching against ' $pattern' : "
case $string in
$pattern) echo " $string: Match. " ; ;
*) echo "$string: No match. " ; ;
Save this script to a file named pattern, make it executable (chmod a+x pattern), and you
can use it to perform your own tests:
$ ./pattern ' *' ' hello'
Matching against ' *' :
$ ./pattern ' hello*' ' hello' ' hello, there' ' well, hello'
Matching against ' hello*' :
hello, there: Match.
well, hello: No match.
Remember to use single quotes around the arg