Fix for createSpy optional parameters and dash

Apparently dash does not understand the `var=something command`
construct, in the sense that it scopes `var` globally, instead of
scoping it just to that command's invocation.