a little help with some csh source

Silver gaynor at topaz.RUTGERS.EDU
Fri Jul 4 01:59:29 AEST 1986


Hi.  I have some cshell source code that isn't performing quite
the way I intend.  I have extracted the relevant code, below.

----------
#!/bin/csh

onintr clean_up

while (1)
    work_like_a_horse
    sleep 10
  end

clean_up:
clean_up_horses_mess
----------

Now, when the process is in the foreground, and I interrupt it
it with ^C, it halts nicely, cleaning itself up.  However, when
the process is in the background, and I send it a kill signal,
it just plain rolls over and dies.  No clean up is performed
(leaving all kinds of junk in /tmp :-).

Have I misinterpreted this excerpt from 'man csh'?

     onintr
     onintr  -
     onintr  label
          Control the action of the shell on interrupts.  The
          first form restores the default action of the shell on
          interrupts which is to terminate shell scripts or to
          return to the terminal command input level.  The second
          form `onintr -' causes all interrupts to be ignored.
        ###########################################################
        # The final form causes the shell to execute a `goto      #
        # label' when an interrupt is received or a child process #
        # terminates because it was interrupted.                  #
        ###########################################################

          In any case, if the shell is running detached and
          interrupts are being ignored, all forms of onintr have
          no meaning and interrupts continue to be ignored by the
          shell and all invoked commands.

I got the impression that - well, you can tell that I always
intend to execute the clean up code ANY time the process is
gunned, despite the caliber.  What does it take?

Thanks in advance...

Silver {...topaz!gaynor}



More information about the Comp.unix mailing list