Adjust script to account for output that doesn't end in a newline