segment: Fix behavior when #! line is not new-line terminated.