Made TestCommandScript more robust against new
lines at arbitrary points.