On Sat, Jan 18, 2025 at 11:54:53AM -0700, Soren Stoutner wrote:
> On Saturday, January 18, 2025 8:41:18 AM MST David Kalnischkies wrote:
> > Am Fri, Jan 17, 2025 at 03:29:39PM -0700, schrieb Soren Stoutner:
> > > if [ dpkg-divert --list | grep courier-mta ]; then
> > Sure, "courier-mta" seems like a string unlikely to appear, but can you
> > be sure?
[..]
> > P.S.: Your grep, if it triggers, also generates output on stdout.
> > At least silence it with -q.
> 
> Wouldn’t output on stdout be a good thing, especially if there is ever some 
> chance this could run when it shouldn’t.

In case anyone hadn't realised: dpkg-divert --list optionally takes an
argument which is glob-matched against package name or path name, so you
don't need grep and can decide whether you want to insist on a full
match or catch more widely, e.g

  [ -z "$(dpkg-divert --list courier-mta)" ] || ...

Reply via email to