0

Am i right that setting the terminal type in inittab entry like so: c2:... tty2 linux-m is only some sort on informative task - sets TERM variable to inform commands/programs/applications which terminal type the system is really is. That is even if the TERM describes terminal as monochrome type but the terminal is indeed capable of displays colors when the command like ls --color=always sends it's output to the terminal i shows colors even if it's defined as non-color in inittab?

1
0

TERM is indeed informative, but many programs/commands will respect it or rely on it.

How colour is produced could depend very much on terminal type. In practice I suspect they all use ANSI (or a superset) where colour is supported.

If TERM is set to a mono terminal type, a program would have to use some other information to decide which type of terminal's colour-control to use. If it defaults to "ANSI" it will likely work in most circumstances nowadays.

This would be a bad thing to do if the terminal is really mono, it would be better for the command/program to use mono methods (e.g. reverse, underline, intensity, strikeout, blink, etc) in place of colour to visually distinguish elements.

If the particular program/command respects TERM (as many do) it is equally likely to report to you that your request for colour is not supported by the terminal type.

See http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/color.html

if(has_colors() == FALSE)
    {   endwin();
        printf("Your terminal does not support color\n");
        exit(1);
    }

I haven't inspected ncurses source code to see how has_colors() is implemented and I don't know what proportion (if any) of programs/commands follow the above pattern.

I find that one piece of very important software respects TERM

TERM=xterm-mono robotfindskitten

(mono display)

On the other hand, ls knows when I am fibbing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.