By now, you've used inc. It has some useful switches that we haven't covered, though.
If you need to keep track of the mail you get, inc -audit will make a log file. The -silent switch prevents the usual scan of messages incorporated. Use -nochangecur when you don't want the current message reset. Your new messages don't have to go in the inbox folder -- you can give inc another folder name. inc also works across a network with POP; the Section Using MH with POP has a quick introduction.
inc can keep an audit file of all the mail you incorporate. By default, it's kept in your MH directory. The log shows when you typed inc as well as scan lines for each message that's incorporated. Here's a piece of an audit file named inc_log. It shows two incs -- the first brought in two messages, and the second brought one more:
% cd Mail % cat inc_log <<inc>> Mon, 09 Jan 1995 08:22:45 -0600 45+ 01/09 root <<The job you submitted to at, 46 01/09 Jim Bob Smith Re: Encapsulation destroying go <<inc>> Mon, 09 Jan 1995 10:53:38 -0600 47+ 01/09 Al Bok Printer<<I am on the VAX systemTo get more information, you can use a scan format file with inc. There are a few standard files or you can make your own format file to log just the information you want. For example, here's a line of the audit file made by the standard scan.time format file. Compare it to the lines in the previous example:
<<inc>> Mon, 09 Jan 1995 17:48:10 -0600 48+ 01/09 17:23EST Samantha Singer Test<<This is a test mTo use an audit file, put the name of the file -- and, if you want one, the scan format file -- in your MH profile:
inc: -audit inc_log -form scan.time
Most users use inbox as a place to sort out new mail and, often, to refile it to other folders. If you want inc to drop the new mail into another folder, you have two choices.
In MH 6.8 and above, inc checks your MH profile for an Inbox: entry. If there is one, inc uses that folder instead of inbox.
In all versions of MH, you can put a folder name on the command line:
% inc +project Incorporating new mail into project... ...In versions of MH before 6.8, if you want to use another folder every time you run inc, you can add +foldername to the inc: entry in your MH profile. But then you won't be able to choose another folder on the command line; you'll get the error inc: only one folder at a time!. That's because, like most MH commands, inc gets all the arguments from both the MH profile and the command line. If you have that problem, try using shell aliases for inc.
Although these features may not be used as often as others, they can be handy.
Keeping inc Quiet
The -silent switch tells inc to bring in any new mail without showing the scan listing. If there's no mail, it will tell you; otherwise, inc won't display anything.
But if you have an audit file set up, -silent also prevents logging the individual messages in that file. All you'll get is the single time-stamp line:
<<inc>> Mon, 09 Jan 1995 18:04:37 -0600If you want inc to be silent on the terminal but also to write a complete audit file, try this command line (assuming you have the inc: -audit entry set in your MH profile):
% inc >/dev/nullThat throws the scan lines which would be on your screen into the UNIX "garbage can" named /dev/null. It still shows the message inc: No mail to incorporate on your screen if there's no mail. You can't put >/dev/null in your MH profile, but you can add a shell alias so that it happens each time you use inc. In csh, for instance:
alias inc '\inc >/dev/null'
Normally, inc changes the current message to be the first one you incorporate. The -nochangecur switch stops that -- inc will still add the new mail to your inbox folder, but it'll leave the current message as it was.
By default, inc reads mail from your default system mailbox -- for example, the file with your username in the /usr/spool/mail directory. There are three ways to change that.
The -file option is good for converting mail "folders" (files full of messages) from the format that many other UNIX mail programs use. The Section Saving Filesystem Space shows how to use -file to read from a message archive made with packf(1).
Delivery-Date Header Field (nmh)
If you use nmh and it was built with the RPATHS configuration option, inc will add a Delivery-Date: header field as it incorporates each new message. When you show the message (unless you've set mhl to ignores=delivery-date) you can see when the message was inced. You can also use this field with scan, pick, and other MH commands that let you act on any header field. For instance, you could use pick to search for all messages you incorporated yesterday and today with pick -datefield delivery-date -after yesterday.
If your system is busy or you're incorporating a lot of messages, this may happen:
% inc Incorporating new mail into inbox... 143+ 01/09 To:email@example.com New MH feature<<Al, scan has ... 450 01/13 firstname.lastname@example.org Where are you?<<I've sent yo inc: new messages have arrived! %The new messages have arrived! means that, while inc was reading from your system mailbox and writing into your inbox folder, your system mailbox was modified somehow. Usually, that's because the system mail transfer agent has written new messages into the system mailbox. Maybe inc's file locking wasn't set correctly when MH was installed.
Normally, inc truncates ("zeros") the system mailbox when it's done. Because inc doesn't want to miss a message, it won't truncate the system mailbox if new messages have arrived. If this happens, make a note of the first and last messages you just incorporated. Run inc again; the same messages -- and the messages that just arrived -- will be incorporated again. To delete the duplicates, remove the messages you incorporated first:
% inc Incorporating new mail into inbox... 451+ 01/09 To:email@example.com New MH feature<<Al, scan has ... 757 01/13 firstname.lastname@example.org Where are you?<<I've sent yo 758 01/13 Al Bok More new MH features<<Now I % rmm 143-450
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. It 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 COPYING.
Copyright © 1991, 1992, 1995 O'Reilly Media, Inc.
Copyright © 1996, 1997, 1999, 2000, 2002, 2004 Jerry Peek
Last modified: 2006-05-31 15:13:43 -0700