GMail - check new messages from the command line
curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '' '{for (i=2; i<=NF; i++) {print $i}}' | wc -l The result will be the number of new letters in your inbox.

Update: the command can be simplified to
curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | awk -F '| ' '{for (i=2; i<=NF; i++) {print $i}}'Thanks for the Wolverine Update tip : and even easiercurl -u username:password --silent "https://mail.google.com/mail/feed/atom" | grep -c "" hints onix74The commands used should be familiar to the sophisticated linux user. For the inexperienced, a brief explanation of what the parts of this line do.
curl - here gets the page at the given address. In this case, it is RSS feed
tr -d '\ n' - removes
awk line breaks - “bites” the necessary parts (the awk language is generally special in various kinds of line parsing. Such a replacement for the regular)
wc -l - count the number of lines
And if the command complicate and parse the output a little, then you can get more information: the sender and the subject of the letter.
curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '' '{for (i=2; i<=NF; i++) {print $i}}' | perl -pe 's/^(.*)<\/title>.*<name>(.*)<\/name>.*$/$2 - $1/'</code></blockquote><br>
<br>
<code><a href="http://www.commandlinefu.com/commands/view/3380/check-your-unread-gmail-from-the-command-line"></a>По материалам commandlinefu</code></div>
</div>
<dl class="post__tags">
<dt class="post__tags-label">Теги:</dt>
<dd class="post__tags-list"> <ul class="inline-list inline-list_fav-tags js-post-tags">
<li class="inline-list__item inline-list__item_tag"><a href="/?q=bash">bash</a></li>
<li class="inline-list__item inline-list__item_tag"><a href="/?q=linux bash scripts">linux bash scripts</a></li>
<li class="inline-list__item inline-list__item_tag"><a href="/?q=gmail">gmail</a></li>
</ul>
</dd>
</dl>
</div>
</div>
</div>
</main>
</body>
</html>