First shot at implementing persistent storage.
When the shell is started in interactive mode, it will load the history for the existing .sh_history if any and truncate it to fit HISTSIZE
When the shell exits the last HISTSIZE line of the history are dumped into the .sh_history file.
Note the behaviour is the same as the one which can be found in bash [1] or many other bourne-like shell.
"When the shell starts up, the history is initialized from the file named by the HISTFILE variable (default ~/.bash_history). The file named by the value of HISTFILE is truncated, if necessary, to contain no more than the number of lines specified by the value of the HISTFILESIZE variable. When a shell with history enabled exits, the last $HISTSIZE lines are copied from the history list to the file named by $HISTFILE."
to avoid sh to creating (or loading) the history file, set HISTSIZE to 0