This may need some improvement could maybe use message number token on a
couple lines rather than the scan -width option but this works for me for
# file: nmhstat.sh - show message count, first message number and last message number.
echo "number of messages:"
echo "first available message:"
scan -width 6|head -1
echo "last available message:"
scan -width 6|tail -1
>This may need some improvement could maybe use message number token on a
>couple lines rather than the scan -width option but this works for me for
Thanks for your script!
So, in the spirit of constructive criticism ... it is probably not
obvious to new nmh users that nmh actually has a pretty rich set of
tools to deal with email. So, for example, you could replicate this
script with the nmh 'folder' command. Also, there are symbolic names
for things like the first and last messages in a folder, and the ability
to define custom message lists (called sequences). This is all documented
in the mh-sequence man page.
It also might interest you that nmh actually has a little embedded
language, documented by the mh-format man page, that is interpreted
by scan, repl, and a few other programs. So you can use this to
interrogate specific header fields of messages, for example. You also
might want to check out the man page for fmttest if you want to try
writing your own (I do not claim the mh-format language is wonderful,
but it does work at it's assigned task).
And finally, the nmh(7) and mh-chart(7) man pages might give you an
idea of all of the commands available and what they do.