For POSIX, $'...'
, as known as ANSI-C escaping, isn't defined.
Instead, you can use the POSIX $(printf '\t')
:
column -t -s "$(printf '\t')"
$(printf '\011')
could be used, as 011
(octal representation of decimal 9) is the ANSI code for a horizontal tab character:
column -t -s "$(printf '\011')"
However this is discouraged as it was commented under this and his answer by Stéphane Chazelas. This is because it may not be consistent across shell versions as POSIX doesn't specify what the encoding of TAB is. There are still POSIX systems whose C locale encoding is EBCDIC based where TAB is 5, not 9 like in ASCII. Wherever possible, it's better to refer to characters by name (\t
here) to avoid this kind of issue. Note that $'...'
is planned for inclusion in the next major version of the POSIX specification as of Sep 10, 2018.