...
We've already seen that quoting variable evaluation preserves the caller's argument quoting (see Quoting subtleties). But more specifically, quoting preserves any special characters in the variable value's text (e.g. tab or linefeed characters).
Consider this case where a captured string contains tabs tabs, as illustrated below.
- evaluating "$txt" inside of double quotes preserves the tabs tabs
- evaluating $txt without double quotes converts each tab to a single space
Since we usually want to preserve tabs, we want to evaluate these variables inside double quotes.
...