trim reading script string (remove '\r', etc.)