Improve handling of different shells.