Remove bashisms, make it dash-compatible