Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Failing to write to history file if containing directory doesn't exist

On 10/9/07, Matthew Wozniski <godlygeek@xxxxxxxxx> wrote:

> On Mon, Oct 08, 2007 at 06:44:45PM -0700, Bart Schaefer wrote:

[I wrote:]

> > } Only under the condition that HISTFILE is written to between the two
> > } commands.

> > Which will be always, if the SHARE_HISTORY and/or INC_APPEND_HISTORY
> > options are set.

> Exactly so.

I was well aware of this.

> > } I still want to play a "don't lose data without trying to save it"
> > } card, but it seems I'm the only one playing cards of that suite.

> > History is only maintained for interactive shells, so you might get
> > more traction with an option to prompt the user to create the directory
> > and/or fix $HISTFILE when the file does not exist or is not writable.

That's a good suggestion.

> Along that vein, and still leaning towards a solution in shell code,
> might it be reasonable to put a precmd hook into the default
> /etc/zshrc to check up on HISTFILE?  That seems like a compromise that
> allows everyone to get it but for it still to be maintained in shell,
> rather than c.

Perhaps putting that in /etc/zlogout would work well enough.
Otherwise, zshexit might be the function to hook.  Of course, if you
use either sharehistory or incappendhistory, perhaps more frequent
checks are desirable.

Messages sorted by: Reverse Date, Date, Thread, Author