New Document

Here is a chart of the meta-characters the Bourne and C shell know about. I have also included several combinations of characters just to make this table more complete. There is a lot of detail on this chart.

List of Special Characters and what they mean
Character Where Meaning
<RETURN> csh, sh Execute command
# csh, sh, ASCII files Start a comment
<SPACE> csh, sh Argument separator
` csh, sh Command substitution
" csh, sh Weak Quotes
' csh, sh Strong Quotes
\ csh, sh Single Character Quote
variable sh, csh Variable
variable csh, sh Same as variable
| csh, sh Pipe character
^ sh Pipe Character
& csh, sh Run program in background
? csh, sh Match one character
* csh, sh Match any number of characters
; csh, sh Command separator
;; sh End of Case statement
~ csh Home Directory
~user csh User's Home Directory
! csh History of Commands
- Programs Start of optional argument
$# csh, sh Number of arguments to script
$* csh, sh Arguments to script
$@ sh Original arguments to script
$- sh Flags passed to shell
$? sh Status of previous command
$$ sh Process identification number
$! sh PID of last background job
&& sh Short-circuit AND
|| sh Short-circuit OR
. csh, sh Typ. filename extension
. sh Source a file and execute as command
: sh Nothing command
: sh Separates Values in environment variables
: csh Variable modifier
Character Where Meaning
[ ] csh, sh Match range of characters
[ ] sh Test
%job csh Identifies job Number
(cmd;cmd) csh. sh Runs cmd;cmd as a sub-shell
{ } csh In-line expansions
{cmd;cmd } sh Like (cmd;cmd ) without a subshell
>file csh, sh Standard output
>>file csh, sh Append to standard output
<file csh, sh Standard Input
<<word csh, sh Read until word, substitute variables
<<\word csh, sh Read until word, no substitution
<<-word sh Read until word, ignoring TABS
>>!file csh Append to file, ignore error if not there
>!file csh Output to new file, ignore error if not there
>&file csh Send standard & error output to file
<&digit sh Switch Standard Input to file
<&- sh Close Standard Input
&digit sh Switch Standard Output to file
>&- sh Close Standard Output
digit1<&digit2 sh Connect digit2 to digit1
digit<&- sh Close file digit
digit2>&digit1 sh Connect digit2 to digit1
digit>&- sh Close file digit

What is important is a solid understanding of the characters that have these special meanings. I will also discuss how you can verify the shell is interpreting the special characters, so you can pinpoint where your problem lies.

There are three different "quotation" marks on the keyboard.. Two of them use marks used for quotations in English usage, and are sometimes called the single quote and double quote.. The third quotation mark is the back quote (more properly called backtick or grave) character: "`". It looks like the single quote and some times people get them confused in shell scripts. The first two are used for quoting phrases in Unix. The back quote is not used for quoting characters. That character is used for command substitution, where the characters between them are executed by the shell and the results is inserted on that line. Example:

% echo the date is `date`

Previous                                                                                                                                                       Next

Back to Top