I think you can use `if system(...)` here; no need to use `$?`.