The first grep in the original script will return "binary file matches" if there are NUL characters in PS1, e.g, emojis. The added line gets rid of NUL characters.