The Unix shells (command line interpreters) assign a special meaning to many of the non-alphanumeric characters on the command line. An incomplete overview (please /msg me with more suggestions)).
used for variable substitution; some of the possibilities:
introduces a variable, whose value will be substituted, e.g. $foo
can be used to delimit a variable name, eg. ${foo}
in /bin/sh-derived shells, other characters are special within ${...}
e.g. ${foo:-bar} denotes the value of $foo if set, or the value 'bar' otherwise
in /bin/csh-derived shells, $?foo is special:
it tests whether $foo is set
the shell tokenizes command lines into words by splitting them on blank characters; to be more exact, it splits them on the value of the IFS (input field separator) variable, which is ' ' by default
in many shells, the {,} brackets (when not preceded by a $) denote the regular disjunction operator: e.g. {{a,b}c{d,e}} is a shorthand for acd bcd ace bce
filename globbing
*, ?, the [] bracket pair, and sometimes, other characters, are used to build expressions matched against filenames on the filesystem
the \ character causes the next character to be taken literally; for example, \\ evaluates to a \ character
', ", and `
single quotes cause the text they enclose to be taken literally; double quotes only prevent certain evaluation steps, but still allow variable substitution; backquotes cause the enclosing text to be taken as a command and evaluate to its output
in many shells, this character is used for history substitution, references to (parts of) previously issued commands
appearing as a separate token, this character starts a comment
<, >
I/O redirection can be used to provide files as the source of input or the target of output, e.g. < infile sort > outfile will put the sorted contents of infile into outfile. More complex things can be done, especially in /bin/sh-like shells; one of them is the << ('here is') syntax that allows input to be specified directly, on the following lines
|, &, ||, &&
these are symbols to chain commands together; the single-symbol form executes them as subprocesses, the second combines them sequentially; the most common form, command1 | command2, is known as a pipe. Back in times when the pipe symbol was not universally available, the ^ character was used instead.
/bin/sh-like shells are really program interpreters; programs are sequences of statements separated by line breaks and/or semicolons
[ ]
in /bin/sh-like shells, when occurring as separate tokens these characters are a built-in syntax for the test comand, that is itself built in into some shells
) and ;;
the special symbols used in the /bin/sh's case statement syntax
used as part of the syntax of the if and while constructs in /bin/csh-derived shells

More details can be provided, but this should suffice to give you the general idea, namely, that many non-alphanumeric characters have special meanings to the shell, although the exact set of metacharacters and their meaning varies from shell to shell. For this reason, it's generally a bad idea to use filenames with non-alphanumeric characters on Unix: almost all of them are technically valid, but very awkward to process by means of shell scripts.

Deliberately omitted from the list above:
/ (directory separator), . (current directory), .. (parent directory)
these can be used in Unix to specify relative pathnames, that is, the locations of files relative to the current working directory; but this functionality is built into the Unix system call API, and some shells merely use what is already there, although some shells (tcsh, zsh) do it in their own way
the null character,
the Unix convention to end strings wih a null implies that shell scripts cannot effectively contain null characters, but this is in no way specific to shells
the flag (option) indicator, -
it is purely by convention that Unix commands introduce options with the - symbol, or in GNU style, with --: the shells themselves contain no code to recognise command options or do anything special with them whatsoever

(Side note: ariels suggested this node and some of its contents.)

Log in or register to write something here or to contact authors.