Fix mounted home directory bug in cdhist.

Bug caused home directory on mounted drive to be replaced by '~' (giving /mnt~
in the history). Fixed so home directory is only substituted at beginning of dir
string.