The script does echo variables:
echo "banned command $cmd: $output"
This is non-portable if there is any possibility that these variables contain backslashes.