The rmm command removes one or more messages. Like most MH commands, if you don't give a message number, rmm acts on the current message.
Let's start this example by removing message 10:
% rmm 10 +somefolder % scan 10 scan: message 10 doesn't existUse these steps to get the message back:
% cd `mhpath +somefolder`
If you don't know the message number, search through the deleted messages with grep for lines that start with the word Subject:. (You can also search for messages by From:, To:, and so on.) Use a wildcard file-matching pattern: \#* if your deleted messages have a hash mark before them, or ,* if they have commas. Also, be sure to use single quotes ('), not backquotes (`):
% grep '^Subject:' ,* ... ,13:Subject: How to attain nirvana ,15:Subject: How to get to Newark ...
% ls 13 ls: 13: No such file or directory % mv ,13 13 % scan 13 +somefolder 13 11/25 yourfriend How to attain nirvana<<Take I-90 to
% ls 13 13 % mv ,13 `mhpath new +somefolder` % scan last +somefolder 94 11/25 yourfriend How to attain nirvana<<Take I-90 to
rmmproc: /bin/rmYou can also set rmm to "remove" messages by moving them to a subfolder named DELETE, where a program can find them and remove them later. This is more convenient for most people because you can scan your removed messages and refile them back into the parent folder (where they came from). To find out about that, read the Section Improve rmm: use rmmer and put this entry in your MH profile:
That scheme lets you recover a deleted message, but it's not very easy. Also, if you delete a message and then later delete another message with the same number, the first "deleted" message will be overwritten by the second one. The rmmer shell script changes that. For instance, when you type, say:
% rmmrmmer moves the deleted message to a subfolder named DELETE. For example, let's say that you deleted a message by accident. To get it back, you look in the DELETE subfolder. Your message will be the last one in the subfolder because you just removed it. You show the deleted message. To recover the deleted message, move it back to the parent folder (where it was before) with refile and a relative folder name. After you recover it, it'll be the last message in the folder. Here's an example:
% rmm % show last @DELETE (Message inbox/DELETE:25) ...A message appears -- this is the one you "deleted"... % refile @.. % show last @.. (Message inbox:54) ...The same message appears -- now it's back in the parent folder...Of course, you can scan the deleted messages, use pick on them, and so forth. You run a periodic job to clean out the DELETE subfolders -- look here for the rm_msgs scripts.
If you don't want rmmer to use a subfolder and instead you want it to put all the messages in a central +DELETE folder, you can call the program with the name rmmer_1, and that'll do it. (The script checks its name and uses that to decide where to move the messages. You use a UNIX link to give the same script more than one name.)
Like the UNIX rm -i command, rmmer can prompt to be sure you want to remove messages. rmmer will only ask in folders where you've created a file named .rmmer.ask. The best way to make this file is with the touch command. It creates a zero-length file which doesn't take any disk space to store. For example, to make rmmer prompt in your archive folder:
% touch `mhpath +archive`/.rmmer.askWhen you remove messages in that folder, you can type n (or just RETURN) to stop the removal:
% rmm last:3 rmmer: remove 91 94 95 in +archive? [ny](n) y(Something interesting happens when you use refile to move a message out of a folder and then answer n when rmmer asks you. The refile command will already have linked the message into the destination folder by the time it runs the rmmproc. You'll end up with a link between the two folders, as if you'd used refile -link.)
Sometimes, rmmer shouldn't prompt, even with a .rmmer.ask file. For example, if a job is running without a terminal on its standard input, like cron, then rmmer will never prompt. If you never want rmmer to prompt (if you use xmh, for example), use one of the versions with .noask on the end of its name, rmmer.noask or rmmer_1.noask.
You don't actually type a name like rmmer or rmmer_1 to run this script. Instead, you put one of its names in your MH profile, for example:
rmmproc: rmmer.noaskThe rmm and refile commands will then run rmmer.noask to "delete" messages.
Because the rmmproc: might be called from a cron job where your shell's search path is short, it's a good idea to use the full pathname in your MH profile:
rmmproc: /xxx/yyy/bin/rmmerThis program is explained in the Section Explanation of rmmer. You'll also need to set up a program to clean out your DELETE folders periodically; see the Section Periodic Cleanup, Checking, etc. with cron and at for tips.
[Table of Contents] [Index] [Previous: Sorting Messages: sortm] [Next: Removing Folders: rmf]
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 <firstname.lastname@example.org>