in reply to script times out mysteriously

Besides what others have said already, you might want to look into the built-in variable $|. That might help with your timeout issues.