From nobody Thu Feb 23 21:20:24 2023 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PN5XW2yH3z3smcb for ; Thu, 23 Feb 2023 21:20:27 +0000 (UTC) (envelope-from freebsd-doc@fjl.co.uk) Received: from bs1.fjl.org.uk (bs1.fjl.org.uk [84.45.41.196]) by mx1.freebsd.org (Postfix) with ESMTP id 4PN5XV33V2z3KXN for ; Thu, 23 Feb 2023 21:20:26 +0000 (UTC) (envelope-from freebsd-doc@fjl.co.uk) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of freebsd-doc@fjl.co.uk designates 84.45.41.196 as permitted sender) smtp.mailfrom=freebsd-doc@fjl.co.uk; dmarc=none Received: from [192.168.1.126] (host81-129-137-223.range81-129.btcentralplus.com [81.129.137.223]) (authenticated bits=0) by bs1.fjl.org.uk (8.14.4/8.14.4) with ESMTP id 31NLKPuj003861 for ; Thu, 23 Feb 2023 21:20:26 GMT (envelope-from freebsd-doc@fjl.co.uk) Message-ID: <809607b3-4ffb-6a34-9715-870481c4db45@fjl.co.uk> Date: Thu, 23 Feb 2023 21:20:24 +0000 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 From: Frank Leonhardt Subject: Re: Cursing the tput utility - the penguin strikes again To: questions@freebsd.org References: <974a81c2-a92d-7f94-5f96-869bddfe21f3@fjl.co.uk> Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-2.08 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; NEURAL_HAM_SHORT(-0.84)[-0.840]; R_SPF_ALLOW(-0.20)[+ip4:84.45.41.196:c]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-0.04)[-0.041]; ASN(0.00)[asn:25577, ipnet:84.45.0.0/17, country:GB]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[questions@freebsd.org]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[fjl.co.uk]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_NONE(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4PN5XV33V2z3KXN X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N 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.