Path: utzoo!utgpu!watserv1!watmath!uunet!shelby!apple!mips!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!rutgers!ukma!rayssd!icus!lenny From: lenny@icus.islp.ny.us (Lenny Tropiano) Newsgroups: unix-pc.general Subject: Re: Killing a shell script Summary: use "trap" Message-ID: <1085@icus.islp.ny.us> Date: 2 Feb 90 13:22:44 GMT References: <1990Feb1.171348.19968@stb.uucp> Reply-To: lenny@icus.islp.ny.us (Lenny Tropiano) Distribution: unix-pc Organization: ICUS Software Systems, Islip, New York Lines: 37 In article <1990Feb1.171348.19968@stb.uucp> michael@stb.uucp (Michael Gersten) writes: |>Ok, how do you kill a ksh shell script on the unix-pc? |> |>I try: kill %1 (job one is a shell script) |>Nothing happens. |>Kill -9 will work, but its a bit extreame. How do you get scripts |>(as opposed to interactive shells) to pay attention to SIGTERM? |> Use the "trap" shell command: eg: $ cat dummy.sh trap "echo Boo ; exit 1" 15 while true do : done $ dummy.sh & [1] 24367 $ kill %1 Boo [1] + Done dummy.sh& Note the number after the trap is the signal. You can specify as many signals as you like after the "commands" This should help?! -Lenny -- | Lenny Tropiano ICUS Software Systems lenny@icus.islp.ny.us | | {ames,pacbell,decuac,hombre,sbcs,attctc}!icus!lenny attmail!icus!lenny | +------- ICUS Software Systems -- PO Box 1; Islip Terrace, NY 11752 -------+