HomeFreeBSD

sh: implement persistent history storage

Description

sh: implement persistent history storage

Implement persistent history storage:
the strategy is simple at start: loads the existing .sh_history file
at exit dump it.

The implementation respects the HISTFILE variable and its POSIX
definition: ~/.sh_history is used if HISTFILE is not set.

to avoid sh to create the history file, set HISTSIZE to 0 or HISTFILE to
en empty value

(cherry picked from commit 988b1bb0c54e50654112f0bd649aee68307a5a80)

sh: try to avoid overwriting HISTFILE produced by other shells

If an attempt to load history from an existing history file was
unsuccessful, do not try to save command history to that file on exit.

(cherry picked from commit 1f82fb3834105fd8f1186b1c6d719d8a24738180)

Details

Provenance
baptAuthored on Mar 30 2021, 8:28 AM
pstefCommitted on Apr 30 2022, 7:55 AM
Parents
rG6e1f0f800689: libfetch: remove a set-but-not-used variable
Branches
Unknown
Tags
Unknown