Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 24 lines (19 sloc) 463 Bytes
#!/usr/bin/env bash
set -eu -o pipefail
newdirs=(~/mail/*/INBOX/new/)
declare -i prevnew=0
out() {
local new; new=$(find "${newdirs[@]}" -type f | wc -l)
if (( new > 0 )); then
printf '<fc=#55ff55>%d</fc>' "$new"
delta=$((new-prevnew))
(( delta > 0 )) && printf '<fc=#feed6a>(+%d)</fc>' $delta
fi
echo
prevnew=$new
}
while true; do
out
inotifywait -qq -e create,delete,move "${newdirs[@]}"
sleep 5
done