Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 820 Bytes

File metadata and controls

23 lines (19 loc) · 820 Bytes

Quoting and Escaping:

  • Double quotes ("): Allow variable and command expansion, but prevent most word splitting and globbing. Example:

    echo "Hello $name"      # Output: Hello World
    echo "This is \$name"   # Output: This is $name
  • Single quotes ('): Everything inside is taken literally. No variable, command, or escape expansion. Example:

    echo 'Hello $name'      # Output: Hello
    echo 'It\'s fine'       # Output: It\'s fine (backslash is not special inside single quotes)
  • Backslash (\): Escape special characters (space, dollar, quote, etc.) to prevent their usual meaning.

    echo Hello\ World       # Output: Hello World
    echo "Hello \"World\""  # Output: Hello "World"
    echo \$HOME             # Output: $HOME