![]() |
Computer Systems Lab CS1000 |
![]() Wiscinfo |
![]() CS Home |
![]() CSL |
![]() CS1000 |
![]() Feedback |
There are a number of characters that have special meaning to the shell, which is what makes them metacharacters. Note that meta- is a generic prefix assuming different meanings for different programs. Be careful not to confuse their meanings or confuse them with metakeys. The metacharacters are listed above and explained further in the man page for csh (the man page for tcsh only describes the enhancements over csh). The following very commonly used metacharacters will prove useful to you; beware of the rest!
Metachar | Function |
; | separates multiple commands on the same line |
? | matches any one character in a file name |
* | matches zero or more characters in a file name |
\ | nullifies the special meaning of the next metacharacter |
As an example,
would show you the files file., file.c, and file.lst., but not just plain old file without a trailing dot. However,
vega1% more file.?
would only show you file.c, as the ? matches one character, no more, no less. This can save you a great deal of typing time. For example, let's say you have a file called california_cornish_hens_with_wild_rice and no other files whose names begin with c. Then you could view the file without typing the whole name like this:
vega1% more c*
because the c* matches that long file name.
Filenames containing metacharacters can pose many problems and should never
be intentionally created. If you do find that you've created a file with
metacharacters, and you would like to remove it, you have two options. You
may use wildcards to match metacharacter or use the to directly
enter the filename. For example, deleting a file named
'| more
can be
accomplished with
vega1% rm ??more
or
vega1% rm \'\|more