#!/bin/bash if [ "$1" != "wrap" ]; then out=$(sudo -Hu amavis "$0" wrap "$@" < /proc/self/fd/0 2>&1) ret=$? lvl="info" if [ "$ret" -ne 0 ]; then lvl="err" fi logger -p mail.$lvl -i -t sa-learn-pipe "${1//[^a-z]/}: $out" exit $ret fi cd "$HOME" cmd=${2//[^a-z\- ]/} sa-learn "$cmd" <(cat -) ret=$? exit $ret