Path: utzoo!attcan!uunet!husc6!uwvax!vanvleck!uwmcsd1!ig!agate!ucbvax!HPLABS.HP.COM!hpsemc!bd From: hpsemc!bd@HPLABS.HP.COM (bob desinger) Newsgroups: comp.mail.mh Subject: Re: unrmm command Message-ID: <8806241604.AA00141@hpsemc.HP.COM> Date: 24 Jun 88 16:04:37 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 79 Here's yet another unrmm that I wrote while waiting for the csh versions to finish. (Well, okay, it's been written for a couple of years now, but the opportunity to bash csh was too good to pass up.) This one tries to preserve the message's original message number, making a new message only if the slot has been filled. You can also give it a +folder argument to unrmm a message in another folder. Finally, the resurrected message doesn't need to be the current one. (I usually decide the next day that I shouldn't have nuked a particular message---the message to unremove is never my current one.) By the way, MTR hates all these unrmm solutions because they don't put back the context, restore the message-sequences, comb your hair, and stop world hunger. Oh well. #! /bin/sh # This is a shell archive. Remove anything before this line, # then unwrap it by saving it in a file and typing "sh file". # # Wrapped by bd at hpsemc on Fri Jun 24 09:01:01 1988 # Contents: # unrmm PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:$PATH; export PATH echo 'At the end, you should see the message "End of shell archive."' echo Extracting unrmm cat >unrmm <<'@//E*O*F unrmm//' #! /bin/sh : unrmm - resurrect a dead mh message, handling optional +folder if [ $# = 0 -o "$1" = "-help" ] then echo 2>&1 "Usage: `basename $0` [+folder] message ..." exit 1 fi fpath=`mhpath` while [ -n "$1" ] do # Handle +folder arguments, if given. case "$1" in +*) # +folder argument specified folder $1 >/dev/null && fpath=`mhpath` shift ;; esac if [ ! -f $fpath/\#$1 ] then # rmm'd file doesn't exist folder=`mhpath` echo 2>&1 `basename $0`: \ "sorry, +`basename $folder`:#$1 isn't there." else if [ ! -f $fpath/$1 ] then # original message slot not filled in yet mv $fpath/\#$1 $fpath/$1 scan $1 else # original message slot was filled newname=`mhpath $folder new` echo 1>&2 `basename $0`: 'original slot is filled;' \ resurrecting $1 as message `basename $newname`. mv $fpath/\#$1 $newname scan `basename $newname` fi fi shift done @//E*O*F unrmm// set `wc -lwc