Okay, to be fair, the idea for this geeklet is not mine, 80% of the script is also found elsewhere on this site. Here's where I got my code, and he's not even the author either. So I accept no credits for the work. :-) Of course you can do a lot of tweaking on this script, but this is how I like it. Learned a lot about sed and tr and awk while making it, by the way.

What it does

It shows you 10 unread mails from your Gmail account. With the name of the sender and the title.


curl -u yourname@gmail.com:yourpassword --silent "https://mail.google.com/mail/feed/atom" | egrep "§/±/g" | sed -e "s/§//g" | sed -e "s/§$//g" | tr "§" "n"  | sed -e "s/<[^>]*>//g" | sed -e "s/([^±]*)±([^±]*)$/2:± - 1±/g" | tr "±" "n" | tail -n20</pre><p> </p>


User Avatar
brian 3143 days ago
Not working for me.  Does the code need to be changed in any way to work in English...?
User Avatar
blucat 3139 days ago
As long as your email ends with @gmail.com you don't need to include it, including it is fine though. If you want sender - title :

curl --silent https://username%40gmail.com:password@mail.google.com/mail/feed/atom/ | awk '//{print $0}//{print $0}' | sed -e 's/]*>//g' | awk 'NR == 0 { x=$0; next } NF { (NR%2||NR==0)?x=x$0"tt":x=x$0"n" } END { print x }' | tail -n3
User Avatar
brian 3134 days ago
Still not working for me.  blucat: I tried removing the "%40" from your code as well, but without any luck.  What am I missing?
User Avatar
blucat 3134 days ago
If you just remove the %40 you'd be putting in "usernamegmail.com". %40gmail.com will tell the server @gmail.com. Removing %40gmail.com from the string I posted works (assmuing you remember to replace username with your username).
User Avatar
brian 3131 days ago
Thanks for your help, and my apologies for not being clear, but i did replace "username" with my name, and likewise "password" with my password for gmail. Other than that I'm using your code, but only partially recognize emails in my inbox mixed in with a lot of gobbly-gook letters, or code or something, that makes it difficult to decifer.  Any ideas?  Please let me know if I'm still not being clear or am leaving out important info.  Thanks in advance for any help you can provide!

Log in to comment or register here.