I want to run a command and compare the result the command produces to another value, and then either echo 0 or 1.
For example (in pseudocode) something along the lines of:
if ($(app --version) == "1.2.3") then echo 1" else echo "0"
Preferably the actual command output from app --version would be suppressed so that only 0 or 1 is written to stdout, depending on the result.
How can I do this with bash? Is there a quick one liner for that?
$(app --version) -eq "1.2.3" && echo "0" || echo "1", but that results in the version being interpreted as a command. Also the output itsn't surpressed. I am not to familiar with the bash scripting syntax. I guess for surpressing the output of the command one could pipe to /dev/null ..? but first i gotta get the actual comparison to work[ "$(app --version)" == "1.2.3" ] && echo 1 || echo 0= not found.