Because users can change their MH directory structures completely, your shell programs shouldn't assume anything about the locations of folders or the names of their MH directories. Instead, use mhpath to get this information.
Here are some examples:
$ folder inbox+ has 23 messages ( 2- 47); cur= 15. $ mhpath /u/ehuser/Mail/inbox $ mhpath last:2 /u/ehuser/Mail/inbox/46 /u/ehuser/Mail/inbox/47 $ mhpath new /u/ehuser/Mail/inbox/48 $ mhpath +somefolder /u/ehuser/Mail/somefolder $ mhpath + /u/ehuser/Mail $ folder inbox+ has 23 messages ( 2- 47); cur= 15.With no arguments, mhpath gives the full pathname of your current folder. If you give message numbers, sequences, or ranges, you'll get the full pathname of each message. The special argument new gives you the pathname that a new message in the folder would have -- useful if you're creating a new message. If you give a folder name, mhpath gives the full pathname of that folder but it doesn't change the current folder. The folder doesn't have to exist yet unless you want the paths of messages in the folder. Finally, an argument of just a plus sign (+) gives the path of the MH directory itself.
You'll almost always use mhpath with command substitution (the backquotes). For efficiency, you can run mhpath once at the start of the shell script to grab things like the location of the user's MH directory and store that information in a shell variable.
[Table of Contents] [Index] [Previous: Mailing Non-interactively: mhmail] [Next: Getting Message Numbers]
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 <jpeek@jpeek.com>