delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/11/11:38:46

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 11 Jul 2002 08:37:22 -0700
From: Dario Alcocer <alcocer AT helixdigital DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: close cygwin window - bash doesnt save history
Message-ID: <20020711083722.A9120@ns.helixdigital.com>
References: <20020711062601 DOT 15635 DOT qmail AT email DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5.1i
In-Reply-To: <20020711062601.15635.qmail@email.com>; from shane_brooks@email.com on Thu, Jul 11, 2002 at 01:26:01AM -0500

On Thu, Jul 11, 2002 at 01:26:01AM -0500, Shane Brooks wrote:
> 
> ----- Original Message -----
> From: Dario Alcocer <alcocer AT helixdigital DOT com>
> Date: Wed, 10 Jul 2002 08:17:50 -0700
> To: cygwin AT cygwin DOT com
> Subject: Re: close cygwin window - bash doesnt save history
>  
> > Even better solution: register a signal handler in your Bash session
> > for SIGHUP; the cygwin1.dll sends a hangup signal when CTRL_CLOSE_EVENT
> > is received.  Something like this:
> > 
> >     $ myclosefn() {
> >         echo "My close func got called." > $HOME/myclosefn.txt
> >         # TODO: add more clean-up logic here
> >     }
> >     $ trap myclosefn SIGHUP
> > 
> > I've tested this, so I know it works.
> 
>  sounds great but perhaps I dont understand the answer - I'm not a programmer or unix boy.  I tried typing the following in a bash session but it didnt execute the exit statement when I closed the window.
> 
> $ myclosefn() {
> > exit
> > }
> 
> $ trap myclosefn SIGHUP

Well, exit by itself won't do what you want.  If you read the bash
manpage, you'll see that there are several environment variables
that control history.  I invite you to read HISTORY (not yelling,
manpage section names are in caps) in the bash manpage.  I *assure*
you, your question *will* be answered by a careful reading.

I like to think that one of the preconditions of using Unix-like
tools like Cygwin is the user must be prepared to read manpages and
examples to accomplish the task at hand and expand their mastery
of the environment.

Hope this helps.

-- 
Dario Alcocer -- Sr. Software Developer, Helix Digital Inc.
alcocer AT helixdigital DOT com -- http://www.helixdigital.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019