16 lines
782 B
Bash
Executable file
16 lines
782 B
Bash
Executable file
#!/bin/sh
|
|
|
|
[ ! -e ~/.local/share/passwords ] && echo "no accounts configured" && exit 1
|
|
|
|
unread=0
|
|
cat ~/.local/share/passwords | while read line; do
|
|
user=$(echo "$line" | awk '{print $1}')
|
|
pass=$(echo "$line" | awk '{print $1}')
|
|
count=$(curl -s --user "${uers}:${pass}" https://mail.google.com/mail/feed/atom/ | grep -oPm1 "(?<=<title>)[^<]+" | sed '1d' | wc -l 2>/dev/null)
|
|
[ $count -ne 0 ] && unread=$((unread + count))
|
|
if [ $user = 'ftpd@insomniac.pl' ]; then
|
|
count=$(curl -s --user "${i}:${pass}" https://mail.google.com/mail/feed/atom/sites | grep -oPm1 "(?<=<title>)[^<]+" | sed '1d' | wc -l 2>/dev/null)
|
|
[ $count -ne 0 ] && unread=$((unread + count))
|
|
fi
|
|
done
|
|
[ "$unread" = "0" ] && echo "no new mail" || echo "^c#161616^^b#fd4285^new mail: ${unread}^d^"
|