Glossary

$ The dollar is used in the shell to reference variables. In regular expressions, it also signifies the end of a line of text.

| The pipe symbol is used to join commands in a pipeline.

\ The backslash is used to indicate that the character following it is to be taken literally and not expanded. There are a few exceptions to this; \\ is a literal backslash, so to embed the string \" the format is \\\". The other major exception is when a backslash is followed by a newline character. This indicates a line continuation, where the current line is joined to the following line. This can be useful for writing clearer, more easily read code.

The backslash does not escape a single quote when within single quotes; echo 'That's all folks' doesn’t work, but nor does echo 'That\'s all folks'. To escape this, you have to include a \' outside of the other quotes: echo 'That'\''s all folks'.

#! The hash-bang (also known as she-bang) is a special pair of characters at the very start of the file, indicating that the executable that follows is the interpreter (and optional arguments) by which the script is to be executed.

& The ampersand tells the shell that the command preceding it is to be executed in the background. The shell remains in the foreground, and the $! variable is set to the PID of the background process.

[ [ is a synonym for the test program.

absolute path An absolute path starts with the slash character; /etc/hosts is an absolute path that indicates a specific file on ...

Get Shell Scripting: Expert Recipes for Linux, Bash, and More now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.