Artificial intelligent assistant

When would someone choose to use a limit string (<<-) instead of format here strings the normal way with <<<? `The - option to mark a here document limit string (<<-LimitString) will suppress leading tabs (but not spaces) in the output.` What I'm wondering is why someone would want to remove the leading tabs when they are processing commands with the "here" method. Is it about readability of output, or cleaning up output if we want to pass it to something else?

It's about readability of the source code. With `<<-`, you can write:


foo() {
cat <<-EOF
hello
EOF
echo do something else
}


instead of


foo() {
cat <<-EOF
hello
EOF
echo do something else
}


giving a more logical indentation.

(Note that SE displays tabs as spaces in the rendered view of the post, so you'll have to imagine the blocks of four spaces there are tabs instead. Or copy and paste from the source view, if you like; it should give the contents with less mangling.)

I think the phrase "limit string" refers to the end delimiter of the here-doc, a thing you always have with one. It's the processing of the tabs that the additional `-` changes. Also, `<<<` is the non-standard here-string, not a here-doc.

.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy de4fd5c1052a6bcbf2c58b4bbc6db7aa