Add defined clause to exec, and use unless instead of not-if