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

Read/write multiple histories from non-interactive shell



Let's say there is a non-interactive script with multiple form fields (each with a different vared), and a user can enter the form multiple times. I want to preserve individual history for each form field.

There are two possibilities: 

1. Keep history internal to the script
        I couldn't find an interface for this. Doing ``fc -p`` once in the beginning of script does provide an internal history, but it is shared between all vareds (which is not ideal).
2. Keep history external to the script
        Not all ``fc`` commands work. ``fc -R`` does read correctly from external history files. But ``print -s``, ``fc-W`` and ``fc -A`` do not. Seems the only option is to do an echo "$string" >>~/path//form_entry_1.hist file. But I guess that has disadvantages because it lacks the benefits that zsh provides in resolving duplicates.

Is there a way out? Should this also be copied to zsh-workers for feature request?

Thanks!

P.S. I can be slow to respond.


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