Lint gsoptimize script

This passes shellcheck now, with fixes to backticks and quoting
parameters (even though, practically, `mktemp` is never going to return
something with spaces).