n...@dad.org wrote: > Paul Fox <p...@foxharp.boston.ma.us> writes: > >n...@dad.org wrote: > >> >I think the simplest thing to do would be to write a custom postproc > >> >and use it to interrogate the draft (using scan(1)) to make sure it was > >> >the way you want. Like if the To: line was blank, exit with a sensible > >> >error message. If you were happy with it, call the real post. > >> > > >> >I've attached the sample postproc I put in the nmh contrib directory; > >> >it's job is to change the switches to post depending on the from line, > >> >but you could use it to see if there's something in the To: header. > >> > >> Would you be willing to tell me how, in such a script, I could detect the > >> presence or absence of a specific header, say "Exception: norm"? (I don't > >> intend or want to enter the currently raging header debate. I'm just > >> asking a > >> specific technical question.) > > > >i think ken would do it with scan(1), but he's one of the few people in > >the world that can write mh-format code off the top of his head. ;-) > > > >i'd use sed: > > > >draftfile=... > >exception_header=$(sed -n -e '/^Exception:/p' -e '/^$/q' < $draftfile) > >if [ "$exception_header" ] > >then > >. > > Except that it would find the string "Exception:" at the beginning of of any > line in the body of the message.
no -- that's what the '/^$/q' is for -- it causes sed to quit at the first blank line in the file. paul =---------------------- paul fox, p...@foxharp.boston.ma.us (arlington, ma, where it's 52.0 degrees) _______________________________________________ Nmh-workers mailing list Nmhemail@example.com https://lists.nongnu.org/mailman/listinfo/nmh-workers