[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Difference between INT and TERM?
From: |
Chet Ramey |
Subject: |
Re: [Help-bash] Difference between INT and TERM? |
Date: |
Sat, 30 May 2015 13:40:43 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 5/29/15 11:22 AM, Peng Yu wrote:
> Hi,
>
> I have the following scripts.
> ==> main.sh <==
> #!/usr/bin/env bash
>
> set -v
> ./script.sh &
> pid=$!
> sleep 1
> kill -s INT "$pid"
>
>
> ==> script.sh <==
> #!/usr/bin/env bash
>
> trap "echo $0:$$:EXIT" EXIT
> sleep 10
> exit -1
>
> I will see something like "./script.sh:15449:EXIT" printed to the
> screen in 10 sec.
>
> But if I change INT in main.sh to TERM, I will see the message printed
> right after kill.
>
> I understand that the default for INT and TERM are both exit. Why they
> are different in the above test cases?
http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00108.html
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/