IDK so much about ksh (i use bash) but what you're describing is not how I know libreadline to work by default. The history buffer is kept in memory and HISTFILE is not written to until the exit of the main loop in readline applications, which should be when you exit bash. So doing export HISTFILE=/home/whoever/.blah will not be written to until you ctrl-d out of the shell. You can easily prove to yourself by typing echo $HISTFILE then on the next line type tail -1 $HISTFILE. Your last command is not there. Now hit ctrl-D and You will log out. Log back in and your history from that old dead shell is now in the HISTFILE.