Article View: comp.os.linux.misc
Article #1529Re: Back To CS Basics. Fuck AI
From: Janis Papanagnou
Date: Tue, 27 Oct 2026 01:26
Date: Tue, 27 Oct 2026 01:26
54 lines
4246 bytes
4246 bytes
On 2026-10-26 23:16, Keith Thompson wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> [...]
>> I want to give you an example code from a little shell tool I wrote:
>>
>> function LINES.set { .kosta.rows=${.sh.value} ; .kosta.update ;}
>>
>> (What this does is that whenever the environment variable 'LINES'
>> changes - e.g. if you pick your mouse and resize the X-window - then
>> that function gets triggered and the actions defined executed.)
>>
>> I'd be interested how you'd implement or emulate that, say, in Bash.
>
> I do something similar in bash, but using a different mechanism (so this
> isn't a response to your challenge).
(It was not so much a challenge but a motivation to think about it.)
> I trap on SIGWINCH.
That's a reasonable alternative for that specific task.
I thought it was an appropriate example because Kornshell's "Discipline
Functions" are of course not only applicable to this specific variable
but to every variable, also user defined.[*] Actually you can associate
such functions, and not only the predefined 'get', 'set', and 'unset',
but also user defined, to any shell variables, existing and introduced.
It was a compact example that stems from a real application not just an
academical one, and it was also compact enough to not get distracted.
It should make it more obvious what simple syntactic features and their
differences in the shells are and where there's a more tight embedding
with the shell mechanisms and features existing. As it was a simple
example to think about I also not really wanted to see a Bash solution,
I know a solution[**] which in the light of that feature I can only call
a workaround, though.
Above sample line contain also another Kornshell specific feature; use
of namespaces. Just BTW. (There's still quite a lot unique features in
Kornshell.)
Janis
[*] It goes further, being able to associate functions to "Types" with
'typeset -T', making code organizations possible that some call "object
oriented".
[**] Actually, there had been a neat idea in the past; Kaz suggested and
developed a shell status line feature for Bash (called "basta"). Since
it was for Bash it had to handle window resizing by another way. I just
adopted the idea of the tool and implemented my version for Kornshell
(called "kosta", to honor the origin of the basic idea) from scratch,
and of course I could make use of such Kornshell-features to simplify
the code.
Technical Details
Message-ID:
<11bouk3$139ta$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com> <POycnb0WPpTmPEz3nZ2dnZfqn_ednZ2d@giganews.com> <87ik32455m.fsf@solcaium.us> <6ad33478$0$28048$426a74cc@news.free.fr> <11b0ms8$iems$8@dont-email.me> <11b0pbe$3pvda$2@dont-email.me> <83se20c7ao.fsf@helmutwaitzmann.news.arcor.de> <11bg381$1bjd2$1@dont-email.me> <RH-dnS_Dp6SSsEH3nZ2dnZfqnPednZ2d@giganews.com> <11bi3f0$2kv20$1@dont-email.me> <YqednVkC15mDTUP3nZ2dnZfqn_YAAAAA@giganews.com> <11bmp6i$36mvl$2@dont-email.me> <11bojg0$10usr$1@kst.eternal-september.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.os.linux.misc,comp.unix.shell Subject: Re: Back To CS Basics. Fuck AI Date: Tue, 27 Oct 2026 02:26:27 +0100 Organization: A noiseless patient Spider Lines: 54 Message-ID: <11bouk3$139ta$1@dont-email.me> References: <18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com> <POycnb0WPpTmPEz3nZ2dnZfqn_ednZ2d@giganews.com> <87ik32455m.fsf@solcaium.us> <6ad33478$0$28048$426a74cc@news.free.fr> <11b0ms8$iems$8@dont-email.me> <11b0pbe$3pvda$2@dont-email.me> <83se20c7ao.fsf@helmutwaitzmann.news.arcor.de> <11bg381$1bjd2$1@dont-email.me> <RH-dnS_Dp6SSsEH3nZ2dnZfqnPednZ2d@giganews.com> <11bi3f0$2kv20$1@dont-email.me> <YqednVkC15mDTUP3nZ2dnZfqn_YAAAAA@giganews.com> <11bmp6i$36mvl$2@dont-email.me> <11bojg0$10usr$1@kst.eternal-september.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 27 Oct 2026 01:26:28 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1157034"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TeQ1reh6Q7zMDtDqIqwEM"; posting-host="ed16f2b47886a355b23095baaf081d24" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:ZW7quZ9lMFYyxnCRkQgf4p92d+k= sha256:fZO8Mlp3DQn3YN4FNYnYfCg2dahKpDK7EnMf2XLe8HY= sha1:+0LFFqdoKT8MuSHOngR5jZyjRzU= sha256:fAiEawe226D0/ythg45c+8RytYEBNNeBT3KPJwtt98c= In-Reply-To: <11bojg0$10usr$1@kst.eternal-september.org> Content-Language: en-US