cd changes to home directory when '~' character is passed as dir