Sujet : Re: [ksh93u+m] alarm timer function
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shellDate : 18. Mar 2024, 06:51:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <ut8kpd$1bcl$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 17.03.2024 21:01, Kaz Kylheku wrote:
On 2024-03-17, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
The program 'busy' could be something like
>
$ cat ~/bin/busy
typeset busy='/-\|'
typeset -i i=0
alarm -r timer +0.25
function timer.alarm { print -u2 -f "%c\b" -- "${busy:i++%4:1}" ;}
( "$@" & wait )
unset timer
>
with 'alarm' and 'timer.alarm' used as supported by ksh93u+.
>
I suppose the 'at' command is not suited for such purposes.
Remember how I rigged something up in the Basta project to spontaneously
update the clock in the status line, while the shell is waiting for
input or running scripts?
Forked process periodically killing parent with signal, which has a trap
handler for it.
Yes, I remember. There's a couple options to solve such a task. In case
I have a simple built-in method available I'd prefer that, though.
Janis