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

Re: Most frequent history words

On 26 April 2016 at 21:39, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Apr 26,  1:03pm, Sebastian Gniazdowski wrote:
> }
> } Interesingly, changing ${historywords[@]} to ${history[@]} and
> } "${history[@]}" doesn't change script's output, it still outputs most
> } frequent words, not history entries.
> I get complete history entries with "${history[@]}" (with or without
> the surrounding quotes).  Are you sure this isn't being affected by
> some other setting such as shwordsplit?

True, it does work. I was mislead by the fact that first 10 entries
were identical – commands like "ls", "git", single word stuff.

The code is slower than core utils pipeline but I've found a nice way
to solve this, wanting to preserve Zsh portability – a cache
regenerated periodically:


This makes the snippet a fine piece of code in general.

Best regards,
Sebastian Gniazdowski

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