diff options
Diffstat (limited to 'dotfiles/.local/bin/barmailstatus')
-rwxr-xr-x | dotfiles/.local/bin/barmailstatus | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/barmailstatus b/dotfiles/.local/bin/barmailstatus new file mode 100755 index 0000000..d40a73d --- /dev/null +++ b/dotfiles/.local/bin/barmailstatus @@ -0,0 +1,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" + |