Bash save and restore history feature

Implementation of the feature discussed in #48.
Thanks @rburny for all the work.