Michael Richardson wrote:
I hadn't thought of just refiling in the order like that.
I rather like it, and I think I'll adopt your script.
thanks.
There were a couple of weaknesses in my simple script. You may know
this already, Michael... but, partly "for the record" (and maybe for
people who haven't seen much nmh scripting before) here's the script
again, then a couple of tricks:
for sequence in `mark -list | sed 's/:.*//'`
do
refile -link $sequence +inbox/sorted
done
PROBLEM #1: The script doesn't re-define the sequences in the
destination folder. That's pretty easy to fix by adding an entry like
this to the .mh_profile:
Previous-sequence: pseq
And use commands like this after the "refile" to copy the "pseq"
sequence into a sequence with the original name, from $sequence:
mark -add -seq $sequence pseq +inbox/sorted
folder -fast +inbox
The "Previous-sequence" entry can slow down nmh because it writes the
pseq sequence after every change to any folder. So it might be better
to have your script make a temporary .mh_profile file that's built from
your default .mh_profile with a "Previous-sequence:" entry added. Point
the MH environment variable to that temporary MH profile while the
script is running:
mhp=/tmp/MHP$$
cat $HOME/.mh_profile > $mhp
echo "Previous-sequence: pseq" >> $mhp
MH=$mhp; export MH
...run nmh commands...
rm $mhp
PROBLEM #2: The script includes the "cur" sequence in the list of
sequences it copies. You can fix that by telling sed not to print that
sequence:
for sequence in `mark | sed -n '/^cur:/!s/:.*//p'`
or pipe mark's output through 'grep -v cur:', or something.
Jerry
--
Jerry Peek, jpeek(_at_)jpeek(_dot_)com, http://www.jpeek.com/