#!/bin/bash
#      ^^^^ Needed for fancy co-processes.

db=$1

[[ -z "$db" ]] && { echo "Usage: $0 <db>" >&2; exit 1; }

slapcat -b "$db" -f /etc/ldap/slapd.conf \
    1> >(gzip >/var/tmp/ldapdumps/"$db".gz) \
    2> >(grep -v \
         -e "no DB_CONFIG file found in directory" \
         -e "Expect poor performance" \
         >&2)