I found another way to solve this:
set +e
find "./csharp/Platform.$REPOSITORY_NAME/obj" -type f -iname "*.cs" -delete
find "./csharp/Platform.$REPOSITORY_NAME.Tests/obj" -type f -iname "*.cs" -delete
set -e
You can turn off failing on errors by set +e
this will now ignore all errors after that line. Once you are done, and you want the script to fail again on any error, you can use set -e
.
After applying set +e
the find
does not fail the whole script anymore, when files are not found. At the same time, error messages
from find
are still printed, but the whole script continues to execute. So it is easy to debug if that causes the problem.
This is useful for CI & CD (for example in GitHub Actions).