Special Characters


Special Characters

lists most of the characters that are special to the bash shell.

Table 9-6. Shell special characters

Character

Use

NEWLINE

Initiates execution of a command (page )

;

Separates commands (page )

( )

Groups commands (page ) for execution by a subshell or identifies a function (page )

&

Executes a command in the background (pages and )

|

Sends standard output of preceding command to standard input of following command (pipe; page )

>

Redirects standard output (page )

>>

Appends standard output (page )

<

Redirects standard input (page )

<<

Here document (page )

*

Any string of zero or more characters in an ambiguous file reference (page )

?

Any single character in an ambiguous file reference (page )

\

Quotes the following character (page )

'

Quotes a string, preventing all substitution (page )

"

Quotes a string, allowing only variable and command substitution (pages and )

'...'

Performs command substitution (page )

[ ]

Character class in an ambiguous file reference (page )

$

References a variable (page )

. (dot builtin)

Executes a command (only at the beginning of a line, page )

#

Begins a comment (page )

{ }

Used to surround the contents of a function (page )

: (null builtin)

Returns true (page )

&& (Boolean AND)

Executes command on right only if command on left succeeds (returns a zero exit status, page )

|| (Boolean OR)

Executes command on right only if command on left fails (returns a nonzero exit status; page )

! (Boolean NOT)

Reverses exit status of a command

$()

Performs command substitution (preferred form; page )

[]

Evaluates an arithmetic expression (page )