# Trap Command Problem

**URL:** <https://community.unix.com/t/trap-command-problem/258654>\
**Category:** Shell Programming and Scripting\
**Created:** [February 1, 2010, 6:44am UTC](https://community.unix.com/t/trap-command-problem/258654 "2010-02-01T06:44:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sundar\_ranga](https://community.unix.com/letter_avatar/sundar_ranga/32/6_22734026db12803ebb3e059622ac3534.png) [@sundar\_ranga](https://community.unix.com/u/sundar_ranga)\
**Post date:** [February 1, 2010, 6:44am UTC](https://community.unix.com/t/trap-command-problem/258654/1 "2010-02-01T06:44:28Z")

</div>

Hi All ,

Could you please help me in resolving the below problem.

I have 2 Script file say

Scrip1.sh  
Script2.sh.

Initially Script1.sh is started executed and inside the script1 , SIGINT is trapped to a separate cleanup process and exit.

While Script1.sh is started executing , CTRL+C is given from Keyboard and it is working fine.i.e Separate Claenup is executed and exit.

In the Script2.sh , the KILL -SIGINIT pid (Pid of Script1.sh ) command is invoked . during this case , Script1.sh is not killed , but it is in HANG State , taking its own time to finally get exit.

Even without invoking Script2.sh , from a separate Terminal , KILL command is issued , but the same behaviour.

Could someone of you help me.

---

<div class="post-metadata">

**Author:** ![Franklin52](https://community.unix.com/user_avatar/community.unix.com/franklin52/32/500_2.png) [@Franklin52](https://community.unix.com/u/Franklin52)\
**Post date:** [February 1, 2010, 7:54am UTC](https://community.unix.com/t/trap-command-problem/258654/2 "2010-02-01T07:54:48Z")

</div>

Typo?

```nohighlight
KILL -SIGINIT pid

```

should be:

```nohighlight
kill -SIGINT pid

```
