bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash cannot kill itself?


From: Andreas Schwab
Subject: Re: Bash cannot kill itself?
Date: Wed, 30 Jun 2010 10:25:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

"Clark J. Wang" <address@hidden> 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 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.

Andreas.

-- 
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]