The Section Work on Draft Folder: scandrafts gives an overview of this script. Here is the scandrafts script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.
Edit the script to change the values of the mh and mhprf variables if you need to. If you're using MH version 6.8 or above, you can set mhprf to $mh/mhparam -- also, edit the draftfold= line to remove the -b option (which mhparam doesn't need).
The only unusual part of the script is the subshell (inside the parenthesis operators) that feeds the pager program. This is a way to collect the output of several commands and channel them all to the same place. This shows the output of all the commands in a group; if there are more than enough lines to fill the screen, the paging program will pause until you use its "continue" command. If the subshell wasn't here, and each individual command was fed to a paging program, the output of each program might scroll the other's output off the screen before you could see it. In the same way, the scan 2>&1 at the end of the subshell merges scan's standard error onto its standard output; this makes errors come out along with the rest of the paged lines.
The script doesn't need to cd back to the directory where it started. That's because, like all shell scripts, scandrafts runs in a subshell. Its current directory of the subshell doesn't affect the current directory of the parent shell (where you ran scandrafts from).
[Table of Contents] [Index] [Previous: Explanation of rmmer] [Next: Explanation of showpr]
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.
Suggestions are welcome: Jerry Peek <email@example.com>