Considering the behavior of handling '\n' character in shell, I don't think this is a safe way to deal with the empty lines.