Re: Bash cannot kill itself?

2010-06-30 Thread Bob Proulx
Chet Ramey wrote: > Andreas Schwab wrote: > "Clark J. Wang" writes: > > > It does not work as I expected. The running script was not > > > terminated after 5 seconds. So what's wrong here? > > > > The shell is waiting for foreground process (sleep) to finish. During > > this time no other process

Re: Bash cannot kill itself?

2010-06-30 Thread Chet Ramey
> > It does not work as I expected. The running script was not terminated after > > 5 seconds. So what's wrong here? > > The shell is waiting for foreground process (sleep) to finish. During > this time no other process will be started by the shell. Yes. The trap is not taken until after the fo

Re: Bash cannot kill itself?

2010-06-30 Thread Andreas Schwab
"Clark J. Wang" writes: > I have a bash script like this: > > #!/bin/bash > > trap 'echo killed by SIGALRM; exit 1' ALRM > > function wait_kill() > { > sleep 5 > kill -ALRM $$ > } > > wait_kill & > > sleep 3600 > > ### END OF THE SCRIPT ### > > It does not work as I expected. The running

Re: Bash cannot kill itself?

2010-06-30 Thread Clark J. Wang
On Wed, Jun 30, 2010 at 2:52 PM, Pierre Gaston wrote: > On Wed, Jun 30, 2010 at 9:12 AM, Clark J. Wang wrote: > >> >> On Wed, Jun 30, 2010 at 1:40 PM, Jan Schampera >> wrote: >> >> It just shows that $$ does what it should do, it reports the relevant PID >> of >> > the parent ("main") shell you