Rather than manually repairing errors caused by the script, just change the script to ignore lines that contain multiple equal signs. This will do it:
for line in `nvram show | grep '^[^=]*=$'`; do var=${line%*=}; nvram unset $var; done; nvram commit