To avoid a subshell, what are the ANSI escape equivalents of
tput sgr0 for an ANSI-compatible terminal?
You could answer that by looking at the output of
-1 option to print one capability per line for a given setting of
TERM (i.e., "ansi"), simplifying a
infocmp -1 ansi |grep sgr0=
and seeing (for example)
which tells you that you could do
to get the same effect as
tput -T ansi sgr0
But you're not using ANSI, but rather some particular terminal, and though the ones you're using are similar, not all are identical. It's more likely that your
TERM variable is set to something like "xterm", which (omitting the terminal type) gives
The common part is the
\E[m, which is the terminfo syntax for
\033[m. The other characters in each sequence are resetting the alternate character set (and can depend on the terminal type).