I'd like to know in a (applescript|bash|python|whatever) script, running on my Yosemite OS X, the sum of unread messages in all accounts of the Apple Mail application - in other words, the same number that appears in Mail's icon badge with the default Apple Mail Preference settings.
Is this scriptable via AppleScript or other means?