Fixed quoting of shell commands.
Moved deletion of temporary results to the end of the test.
Fixed deprecated syntax.