The storeparts Shell Script

[return-to Explanation of storeparts] [table of contents] [index]
#! /bin/sh
# $Id: storeparts,v 1.0 1995/07/12 14:37:22 jerry book3 $
#
### storeparts - find all parts of current message/partial and store them
### Usage: storeparts [msgs]
##
##  storeparts gets the "id=" field from the Content-Type: header
##  field of the current message.  Then it searches for other parts
##  with the same id= string and gives the messages to 'mhn -store'.
##
##  msgs is the list of messages in the current folder to search for
##  other parts.  The default is all messages.

# GET "id=" STRING FROM CURRENT MESSAGE:
ctype=`scan -format '%{content-type}' cur` || exit
id=`expr "$ctype" : '.*\(id="[^"]*"\)'` || exit
echo "`basename $0`: searching for '$id'." 1>&2
# FIND MESSAGES IN $1 (DEFAULT: ALL MESSAGES) WITH $id IN "Content-Type:".
# STORE IN temp SEQUENCE:
pick --content-type "$id" -seq temp $1 || exit
# IF pick DIDN'T FIND ALL MESSAGES, mhn WILL COMPLAIN AND QUIT:
mhn -store temp

[Table of Contents] [Index] [Return to Explanation of storeparts]


Last change $Date: 1996/06/06 15:13:55 $

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>