If only conditions 1 and 2 are satisfied: outputA outputB
If only condition 3 is satisfied: outputC
If all conditions are satisfied: outputA outputB outputC
If only 1 or 2 or none are satisfied: <empty output>
Failure Conditions and Exit Codes
If the final arguments are Version Conditions (i.e. conditions not followed byOutput), failure to satisfy the conditions will
cause a VersionConditionError to be thrown and the process to exit with a non-zero error code.
You can use this with the bash || operator to skip commands for some versions.
node-version --lt-3.0.0 || node-version --gte-4.0.0 || npm run node-3-only-tests
Note that using || means the following command runs only when the conditions fail.
Running only when the conditions pass is doable, but a bit more convoluted.
It is often easier to just invert your condition and stick to using ||.
Command Substitution
When combined with Command Substitution this becomes a powerful construct for controlling how bash scripts behave.
The original intended use was disabling the babel compiler for mocha tests running in newer versions of node (which already support some ES6 features).
The stack trace is often obfuscated when using the babel compiler (the line numbers won't match up).
Getting rid of babel improves performance, and gives nice stack traces on Node 4+. This scripts allows you to
continue running your CI tests against old versions of Node.