Introduction

The Bourne-Again Shell (bash) is the most common shell found on Linux systems.

Scripting

Quoting

Quoting is used to tell bash to ignore any special meaning which characters or words may have and to treat them literally. There are a few ways to do this and they have certain differences.

A backslash (\) tells bash to treat the next character literally, ignoring any special meaning it might have. The only exception is the newline character. A backslash before a new line tells bash to completely ignore the newline character.

Surrounding text with single quotes ('text') is used to treat all characters between the single quotes literally. However, text itself is not allowed to contain single quotes because any single quote would just match with the single quote before it and terminate the quotation. Not even a backslash can be used to achieve this because a backslash between single quotes is treated literally just like any other character.

Double quotes ("text") are used to treat all characters in text literally except for $, \, ` and !.