On Mon, Jun 15, 2020 at 01:48:46PM +0200, Klemens Nanni wrote: > On Mon, Jun 15, 2020 at 01:39:11PM +0200, Marc Espie wrote: > > The idea looks fine, I"m not quite sure it works nor is perfect. > Why would it not work? > > > [ ] && echo will only succeed if the first part succeeds, ouch. > That's the point: list patches only if there are any to list in the > first place.
I was under the impression that you need if test under set -e. Please do if ... fi anyway I definitely prefer doing it that way. > > I would just display failed patches if $$error, the "can't find patch > > matching $$i" happens so seldom that it won't be confusing. > Why have inconsistent output in those seldom cases if we can do it > properly for relevant cases only? Because it makes for simpler logic. If you want to keep the test, it should definitely be under if $$error and not outside of it. > > You do not need to initialize the variable. > It adds to readability and, depending on sh's -e and/or -u usage, using > the variable unconditionally as you suggest could fail without it being > initialised. -u is not an option... we have a few things that are intentionally not in the environment, like _DEPENDS_CACHE, that break -u entirely.