finalise pwd and cd for sh, fs, and ssh