Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Works for me. Did you copy and paste it or did you retype it yourself? If you retyped it realize that it uses back ticks rather than apostrophes. Copy and paste the following into Terminal and see what result it gives.

Code:
echo `/usr/bin/osascript -e "tell application \"Mail\" to set unreadCount to unread count of inbox as string"`;
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.