5 SC2141
Joachim Ansorg edited this page 2021-11-12 19:38:21 +01:00

Did you mean IFS=$'\t' ?

Problematic code:

IFS="\t"

Correct code:

IFS=$'\t'

or POSIX:

IFS="$(printf '\t')"

Rationale:

IFS="\t" splits on backslash and the letter "t". IFS=$'\t' splits on tab.

Exceptions

It's extremely rare to want to split on the letter "n" or "t", rather than linefeed or tab.

See https://github.com/koalaman/shellcheck/wiki/SC1012