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 17/10/2007, Matthew Wozniski <godlygeek@xxxxxxxxx> wrote:

> > Perhaps check when the shell starts and in the history write function.
> > precmd should be as light as possible.
>
> As Bart noted earlier in this thread, history writes occur once per
> command anyway for users with SHARE_HISTORY or INC_APPEND_HISTORY set.

Yah, that is why I worded it that way :)


> And a solution handled during a history write can't be handled
> directly in shell code.  That's exactly what my suggestion was aimed
> at avoiding.  The only advantage I can see to handling it in C would
> be that it would add only one extra instruction for an unexceptional
> write (if (errno != ...) ) instead of the full cost of a glob and
> a parameter expansion, which are presumably much more expensive.

Exactly. To me, the only clean solution would be a new option.


> But, either way, I'm still against this proposed feature; I still find it
> to be unnecessary at best.

I would not want to use it, either. My comments are more geared towards
'if one would do it, this could be a good way'.


An easy, light and scriptable solution that solves 99% of all cases has
already been hinted at:

export HISTDIR=foo
mkdir -p $HISTDIR || echo 'Woe is me!'
export HISTFILE=$HISTDIR/bar


Richard
>
> ~Matt
>



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