2022-07-30 22:17:25 +02:00
|
|
|
#!/usr/bin/env bash
|
2022-07-30 07:17:12 +02:00
|
|
|
|
|
|
|
UNREAD_ONLY=true
|
|
|
|
MAIL_DIR=~/.local/share/mail
|
|
|
|
|
|
|
|
mailcount=0
|
|
|
|
|
|
|
|
if [[ -d ${MAIL_DIR} ]]; then
|
2022-07-30 22:17:25 +02:00
|
|
|
for dir in "${MAIL_DIR}"/*/; do
|
2022-07-30 07:17:12 +02:00
|
|
|
# get file count for the unread mailbox, add to count
|
|
|
|
mailcount=$(( $( ls ${dir}INBOX/new | wc -l ) + $mailcount ))
|
|
|
|
|
|
|
|
# also add the rest of the inbox if var is set
|
2022-07-30 22:17:25 +02:00
|
|
|
if ! ($UNREAD_ONLY); then
|
2022-07-30 07:17:12 +02:00
|
|
|
mailcount=$(( $( ls ${dir}INBOX/cur | wc -l ) + $mailcount ))
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ${mailcount}
|