#! /usr/bin/sh WATCHLIST="$(systemd-path user-shared)"/package-alert/watchlist agg_results="" if [ -f "${WATCHLIST}" ]; then while read -r pattern; do pat_results=$(apt-cache search --names-only "${pattern}") if [ -n "${pat_results}" ]; then agg_results="${agg_results:+${agg_results} }Packages matching \"${pattern}\": ${pat_results} " fi done < "${WATCHLIST}" fi if [ -n "${agg_results}" ]; then printf '%s' "${agg_results}" | /usr/sbin/sendmail "${USER}" fi