O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Quoting

Quoting disables a character’s special meaning and allows it to be used literally, as itself. The following table displays characters that have special meaning to the Bash shell.

Character

Meaning

;

Command separator

&

Background execution

( )

Command grouping

|

Pipe

< > &

Redirection symbols

* ? [ ] ~ + - @ !

Filename metacharacters

" ' \

Used in quoting other characters

`

Command substitution

$

Variable substitution (or command or arithmetic substitution)

space tab newline

Word separators

These characters can be used for quoting:

" "

Everything between " and " is taken literally, except for the following characters that keep their special meaning:

$

Variable (or command and arithmetic) substitution will occur.

'

Command substitution will occur.

"

This marks the end of the double quote.

' '

Everything between ' and ' is taken literally except for another '. You cannot embed another ' within such a quoted string.

\

The character following a \ is taken literally. Use within " " to escape “, $, and '. Often used to escape itself, spaces, or newlines.

$” "

Just like " ", except that locale translation is done.

$' '

Similar to ' ', but the quoted text is processed for the following escape sequences.

Sequence

Value

Sequence

Value

\a

Alert

\t

Tab

\b

Backspace

\v

Vertical tab

\c X

Control character X

\ nnn

Octal value nnn

\e

Escape

\xnn

Hexadecimal value nn

\E

Escape

\'

Single quote

\f

Form feed

\”

Double quote

\n

Newline

\\

Backslash

\r

Carriage return

  

Examples

$ echo 'Single quotes "protect" double quotes' Single quotes "protect" double quotes $  ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required