Re: file .bash_history

Philippe Delavalade <[email protected]> Wed, 11 Nov 2015 16:42:46 +0100
Newsgroups gmane.linux.slackware
Message-ID <20151111154246.GA1127@messier31>
Le mercredi 11 novembre à 14:57, Arkadiusz Drabczyk a écrit :
> On 2015-11-11, Philippe Delavalade <[email protected]> wrote:
> > Hi all.
> >
> > I hope I'll be claer because my english is not fluent :-)
> >
> > When I'm logged as USER, for instance, on tty2, if I do "logout", the file
> > .bash_history is updated (.bashrc contains line 'shopt -s histappend').
> >
> > But when I'm halting the system, this file is not updated. What can I do ?
> >
> > May be I can add some lines in /etc/rc.d/rc.local_shutdown but I don't know
> > which ones :-(
> >
> > I examined /etc/rc.d/rc.6 but this didn't help me.
> >
> > Thanks for help or suggestions.
> >
> 
> Something like this will do the job:
> 
> $ PROMPT_COMMAND="history -w; $PROMPT_COMMAND"

thanks, that works fine but...

> It will not overwrite your current $PROMPT_COMMAND

Yes it does. In .bashrc I have another prompt_command that doesn't work
anymore. And I want tokeep the old one.

> and make Bash
> append current history to $HISTFILE after every command execution and
> not only when a shell exits.
> 
> BTW, be aware of difference between login and non-login shells.  When
> you log in for an interactive session in tty ~/.bashrc is not read and
> the above should be added to ~/.profile.

OK. I'm going to read more about this.

Regards.

-- 
Ph. Delavalade

_______________________________________________
slackware mailing list
[email protected]
https://mailman.lug.org.uk/mailman/listinfo/slackware