fix support for spaces in test command arguments

Use `bash -c "$CMD"` to handle argument parsing rather than doing it manually