> 
> > Could anybody show me how to use the alarm command
> of ksh?
> > I don't quiet understand the output of alarm --man:
> > # alarm --man
> > Usage: alarm [-r] [varname seconds]
> > 
> > Knut
> > 
> 
> alarm hasn't been documented because it is not
> working in all cases.
> 
> Here is an example of code that shows how it is
> supposed to work:
> =======================cut
> here==============================
> alarm -r tbar +10
> tbar.alarm()
> {
>         printf $'\E]0;%T  %s\a' now "$PWD"
> =================cut
> here==============================
> 
> This code sets an alarm that goes off every 10
> seconds.  By defining
> an alarm variable with alarm, you can specify a
> callback function var.alarm
> that will execute when the alarm expires.
> 
> In this case the title bar is updated with the
> current time and the
> current working directory every 10 seconds.
> 
> David Korn
> dgk at research.att.com


I see that the connection nbetween the variable and the callback function is
dependent on the order of the commands; absent an "alarm var N" command,

$ function bogus.alarm
More? {
More? date
More? }
ksh93: bogus.alarm: invalid discipline function

But in another order different from the original example:

alarm -r junk +2
function junk.alarm
{
        date
}
alarm -r junk +1

the 2nd alarm command doesn't remove the existing junk.alarm function, but
doesn't make use of it either.  By comparision, a var.set function seems to 
disappear
if the corresponding var is unset.

Whatever the proper understanding of the relationship between variables and 
discipline
functions might be, I'd feel a lot better if it were more clearly spelled out; 
and if alarm
is one day to become documented, that it be more consistent between alarm and 
other
discipline functions (or else described in enough detail to understand the 
difference).
 
 
This message posted from opensolaris.org

Reply via email to