Re: Cursing the tput utility - the penguin strikes again

From: Frank Leonhardt <freebsd-doc_at_fjl.co.uk>
Date: Thu, 23 Feb 2023 21:20:24 UTC
On 23/02/2023 18:29, Daniel Tameling wrote:
> On Thu, Feb 23, 2023 at 04:45:21PM +0000, Frank Leonhardt wrote:
>> So there's a tput utility for controlling the terminal in BSD. It takes
>> "attributes" and arguments and outputs whatever control codes are 
>> needed to
>> make the terminal do what you need in a portable way (switch to bold, 
>> move
>> the cursor, clear to EOL or whatever). It doesn't matter if you're 
>> using an
>> VT52 terminal or xterm - tput does the translation.
>>
>> snip
>> So my question is, assuming one wants one's scripts to be compatible with
>> Linux, what's the best way of going about it? Is there some new
>> platform-independent way of doing this I'm too old to know about, or 
>> do you
>> really have to write shell scripts to cope with both by defining the 
>> code to
>> use up front based on the output of uname?
>>
>>
>> Did you try using the tput from devel/ncurses instead? I once ran into
>> a similar problem and if I remember correctly that one works with the
>> same options as on Linux because it's the one installed there. And it
>> is frequently already installed as a dependency; the problem is just
>> that the FreeBSD tput is earlier in PATH.

Thanks - I didn't know about that, and it's good to know.

It's not the solution I wanted as for compatibility I'm sticking with 
the base system. I think the "problem" is that BSD is using termcap 
definitions whereas Linux us using terminfo, which is logical as it's 
newer, but wrong!

Regards, Frank.