quote command and test for exit status