fix bashisms in run and finish scripts