Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.unix.questions Subject: Re: onintr, trap, etc. Message-ID: <15683@smoke.brl.mil> Date: 3 Apr 91 00:21:38 GMT References: <1991Apr1.201415.5305@engin.umich.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 13 In article <1991Apr1.201415.5305@engin.umich.edu> mjo@ais.org writes: -I am trying to write a script that will only run when I receive a -hangup signal (i.e. when I am forcibly disconnected). -#!/bin/sh -#deathtrap -- will run these commands if I get HUPped -trap hangupscript 0 -When I run this interactively with: -% nohup deathtrap & -The script wants to run immediately. Of course it does -- trap #0 means upon EOF, which occurs at the end of the "deathtrap" shell script. Try trap #1, and make sure the "deathtrap" script doesn't terminate except upon the trap.