next up previous contents
Next: Piping & Redirection Up: Files & Directories Previous: Groups

Wildcards

In the previous sections we have seen that some commands like ls, cp, mv, rm, chmod, chgrp, can take a list of filenames as arguments. As it is quite laborious to type out a whole list of filenames UNIX provides wildcards through the shell. There are two wildcards:

The ? can stand for any one character.

EXAMPLE:

?arry can stand for barry, larry, harry, Barry and so on.

??rry con stand for barry, lorry, Barry, Lorry and so on.

The * can stand for any number of characters.

EXAMPLE:

m*m can stand for mm, mum, my_rum and so on.

It is also possible to mix ? and *. The effect of using wildcards is that the shell creates a list of filenames. This is important to know, as the program called with a wildcard expression always sees a list of files. Programs that do not support a list of files on their command line sometimes display weird behaviour, if presented with such a list.



Mark O. Stitson
Wed Sep 25 10:45:32 BST 1996