Write command in tempfile and execute that

This fixes #10 and fixes #11