Escaping and Quoting
Whenever you type anything on the command-line or into a shell script, you’ll be using a mix of normal alphanumeric text and non-alphanumeric characters. Some of these characters have special meanings within the shell, and will cause the shell to perform in some special way. Sometimes, you’ll want the shell to interpret these special characters as normal text, instead of as something with a magical power. To do that, you can either escape or quote the special characters.
There are two general classes of characters that can be interpreted by the shell from within a shell command. These are:
- Normal characters:
bash
andzsh
interpret these characters literally. In other words, they have no special meaning to the shell. - Metacharacters: These characters have special meanings for
bash
andzsh
. You could say that a metacharacter provides some sort of special instruction to these shells.
Here’s a space-separated...