From: Chris F.A. Johnson on
On 2009-11-20, Ivan Shmakov wrote:
>>>>>> "CFAJ" == Chris F A Johnson <cfajohnson(a)gmail.com> writes:
>>>>>> "IS" Ivan Shmakov wrote:
>
> IS> Ncurses comes with tput(1) bundled. I'm not sure how widely it is
> IS> available.
>
> [...]
>
> CFAJ> It doesn't work everywhere. On some systems, the following does
> CFAJ> nothing:
>
> > tput setaf "${color[$i]}"
>
> I've meant ``a fully-working tput(1)'' by ``it'' specifically in
> the sentence above.
>
> My Shell experience was limited mostly to GNU/Linux systems, and
> would /it/ fail on one under my rule, I'd immediately suspect a
> problem with the terminfo(5) database to be reported to the
> developers in charge.

The POSIX standard only requires that tput support three operands,
clear, init and reset. All else is implementation defined, and many
things are not included in all implementations, and therefore not
portable.

--
Chris F.A. Johnson, author <http://shell.cfajohnson,com/>
===================================================================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
===== My code in this post, if any, assumes the POSIX locale =====
===== and is released under the GNU General Public Licence =====
From: Ivan Shmakov on
>>>>> "CFAJ" == Chris F A Johnson <cfajohnson(a)gmail.com> writes:
>>>>> "IS" == Ivan Shmakov wrote:
>>>>> "CFAJ" == Chris F A Johnson <cfajohnson(a)gmail.com> writes:
>>>>> "IS" Ivan Shmakov wrote:

[Whoops, got it sent personally. Sorry for that.]

IS> Ncurses comes with tput(1) bundled. I'm not sure how widely it is
IS> available.

CFAJ> It doesn't work everywhere. On some systems, the following does
CFAJ> nothing:

>>> tput setaf "${color[$i]}"

IS> I've meant ``a fully-working tput(1)'' by ``it'' specifically in
IS> the sentence above.

CFAJ> The POSIX standard only requires that tput support three
CFAJ> operands, clear, init and reset.

Well, then it should've read ``a fully-working, Ncurses-based
tput(1)'' instead, right? (And I'm really puzzled about how I'd
call the tput(1) I'm accustomed to.)

CFAJ> All else is implementation defined, and many things are not
CFAJ> included in all implementations, and therefore not portable.

Given that animating a starfield is such a toy task, the
requirement to install Ncurses, or, why, even a Debian GNU/Linux
with its ``standard'' and ``GNOME'' tasks under, say, QEMU, for
it to work, doesn't seem to me entirely unreasonable.

Fortunately, the portability is rarely an end by itself.

IS> My Shell experience was limited mostly to GNU/Linux systems, and
IS> would /it/ fail on one under my rule, I'd immediately suspect a
IS> problem with the terminfo(5) database to be reported to the
IS> developers in charge.

--
FSF associate member #7257