Skip to content
Joachim Ansorg edited this page Nov 12, 2021 · 4 revisions

When using <<-, you can only indent with tabs.

Problematic code:

Any code using <<- that is indented with spaces. cat -T script shows

    cat <<- foo
        Hello world
    foo

Correct code:

Code using <<- must be indented with tabs. cat -T script shows

^Icat <<- foo
^I^IHello world
^Ifoo

Or simply don't indent the end token:

    cat <<- foo
      Hello World
foo

Rationale:

<<-, by design, only strips tabs. Not spaces.

Your editor may be automatically replacing tabs with spaces, either when you type them or when you save the file or both. If you're unable to make it stop, just don't indent the end token.

Exceptions

None. But note that copy-pasting code to shellcheck.net may also turn correct tabs into spaces on some OS.

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally