"tput sgr0" giving an empty string

I installed FreeBSD 9 in a virtual machine to try it out. I installed bash, and attempted to use tput to provide colors for my scripts. However, I have a slight problem with it.

Code:
[[ -n "$(TERM=rxvt tput sgr0)" ]] || echo fail
fail
[[ -n "$(TERM=xterm tput sgr0)" ]] || echo fail
fail
[[ -n "$(TERM=xterm-color tput sgr0)" ]] || echo fail
fail
I asked around a bit and was told to check infocmp. I googled, found it was part of ncurses, so I did pkg_add -r ncurses.

Now I have infocmp, which lists a whole lot of information about my default terminal, rxvt. tput still provides nothing but empty strings however.

How do I make tput output something useful? I'd rather not use hardcoded colors, as the scripts I'm trying to port from Linux use tput for their colors already and I want to change them as little as possible.

I am connecting to the machine through SSH, by the way.
 
tput sgr0

The tput in FreeBSD's base uses termcap mnemonics. It is not part of ncurses. The ncurses tput recognizes either termcap or terminfo mnemonics if it is configured to support termcap parsing (barring one special case which is ambiguous).

The termcap mnemonic corresponding to sgr0 is "md".
 
Back
Top