bash ignore specific error code (pytest no tests warning error code 5)
<p>I have a program which tests the error code of a script/command I provide.
In some cases the command line returns a warning error code which i would like to ignore (exit with 0 instead of 5). I would like other error codes to pass the same, and for that to be a simple as possible (to keep that a single line command).</p>

<p>I've tried using <code>pytest || [ $? -eq 5 ]</code>, which ignores error code 5 coming from command but will replace all non-zero error codes with 1 (instead of the actual error code).</p>

<p>I guess someone more experienced than me with bash could come up with a better solution faster than I.</p>

<p>Some more specific context:</p>

<p>I'm using pytest to test my projects. Some of them have no tests at the moment and pytest's default behavior is to treat that as an error (error code 5). I would like to treat that error as a success. Actually, I would like Travis to threat that error as success.</p>

<p>Thanks!</p>