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

Re: confused by history



On May 12,  8:58pm, Eric Smith wrote:
} Subject: confused by history
}
} Problem is that I cannot seem to grow my history file - as you can see by
} the grep -i from my zshrc I am quite ambitous.  I often toggle setting

What do you mean by "toggle setting" here?

} and go wc -l $HISTFILE but get no more that 500 or up to 1000 if lucky -
} what could be keeping the file small?
} 
} grep -i /etc/zshrc:

Is all this stuff really in /etc/zshrc?  Why isn't it in ~/.zshrc instead?
What IS in ~/.zshrc?  Anything in ~/.zshrc is run after /etc/zshrc, so if
you have e.g. HISTSIZE=500 there, the setting in /etc/zshrc won't matter.
What about /etc/zlogin and ~/.zlogin, which are run even later?

Have you looked at the output of `print $HISTSIZE $SAVEHIST' to see whether
the variables are really set to what you expect?

} set INC_APPEND_HISTORY 
} set SHARE_HISTORY 

Those should be setopt, not set, but the first one gets a setopt below.

} export HISTFILE=~/.zsh_history
} export HISTSIZE=10000
} export HISTFILESIZE=10000

There's no such thing as HISTFILESIZE, at least in zsh.  Bash, maybe?
Yeah, that seems to be it.  How'd that sneak into /etc/zshrc?

} export SAVEHIST=10000
} setopt
}       append_history \
} 		bang_hist \
} 		hist_allow_clobber \
} 		hist_expire_dups_first \
} 		hist_ignore_all_dups \
}       histignoredups \
} 		inc_append_history \
}       hist_ignore_dups \
}       extendedhistory 

The doc for inc_append_history says:

INC_APPEND_HISTORY
     This options works like APPEND_HISTORY except that new history
     lines are added to the $HISTFILE incrementally (as soon as they are
     entered), rather than waiting until the shell is killed.  The file
     is periodically trimmed to the number of lines specified by
     $SAVEHIST, but can exceed this value between trimmings.

So my guess is that somewhere you have a SAVEHIST=500 which is causing
inc_append history to periodically trim the file.  If you happen to look
at it between trimmings, it'll be bigger, hence "up to 1000 if lucky."

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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