Preserving shell environment behavior