#!/bin/bash for file in $@ do clamscan --stdout --no-summary --infected ${WATCHMAN_ROOT}/$file EL=$? if [ $EL -eq 1 ] then # Virus found echo "Virus found: ${WATCHMAN_ROOT}/$file" | \ mailx -s "Virus found" mail@example.com elif [ $EL -eq 2 ] then # Clamscan error echo "Scan error: ${WATCHMAN_ROOT}/$file" | \ mailx -s "Scan error" mail@example.com fi # Else no virus found done