Summary

In this chapter, you looked at three types of quoting and when to use them:

  • Backslash

  • Single quote

  • Double quote

In addition, you learned several quoting rules:

  • A backslash takes away the special meaning of the character that follows it.

  • The character doing the quoting is removed before command execution.

  • Single quotes remove the special meaning of all enclosed characters.

  • Quoting regular characters is harmless.

  • A single quote cannot be inserted within a single quoted string.

  • Double quotes remove the special meaning of most enclosed characters.

  • Quoting can ignore word boundaries.

  • Different types of quoting can be combined in one command.

  • Quote spaces to embed them in a single argument.

  • Quote the newline to continue a command on the next line.

  • Use ...

Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition 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.