properly terminate string (and redirect)