Is there any standard command that will negate the the exit code of another command provided as an argument without using shell features, or starting a shell?
I have a program that does something based on exit code of an system()
call. I have another program that returns its status via the exit code. But the program I am calling returns the results opposite from what I want. I can simply specify something like bash -c '....'
, but is there an easier way?
P.S. Yes, I know I am probably trying to optimize something that probably doesn't really matter all that much. But mostly I am curious, since unix seems to have a command for almost everything, why I can't find a simple negate-the-exit-code command.