Bangladesh ahead in topsy-turvy Test