This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: close cygwin window - bash doesnt save history


On Thu, Jul 11, 2002 at 01:26:01AM -0500, Shane Brooks wrote:
> 
> ----- Original Message -----
> From: Dario Alcocer <alcocer@helixdigital.com>
> Date: Wed, 10 Jul 2002 08:17:50 -0700
> To: cygwin@cygwin.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@helixdigital.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]