aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/barmailstatus
blob: d40a73de465ac405b781dc2f6dc1a5b68d37f7c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

total=0

# Check all accounts/mailboxes for new mail.
for mailbox in "$HOME/.local/share/mail/"*
do
	account="$(echo "$mailbox" | sed "s/.*\///")"
	newcount=$(find "$HOME/.local/share/mail/$account/INBOX/new/" "$HOME/.local/share/mail/$account/Inbox/new/" "$HOME/.local/share/mail/$account/inbox/new/" -type f 2> /dev/null | wc -l)
  total=$((total + newcount))
done

[ $total -gt 0 ] && echo "$total"