Csh & foreach causing fork problems

Phil Howard KA9WGN phil at ux1.cso.uiuc.edu
Tue Mar 26 09:12:12 AEST 1991


rickert at mp.cs.niu.edu (Neil Rickert) writes:

> Your problem is not really that 'foreach' is starting up a new process.
>It is that 'mail' (which I presume is /usr/ucb/mail) is starting a new
>process to put the delivery into the background.

> The real question is:

>	Why on earth are you doing this?

> Why not send a single message to multiple recipients?  For example,
>	mail -s $1 `/bin/ls /u/student` < $2

The usual reason for not doing this is that the header will end up having
a huge list of addresses that have to be skipped over to read the mail.
It is most annoying.

>or even build the mail with the subject header (and perhaps a
>'To: all-students:;' header)  in a file, and submit it to
>/bin/mail with the list of recipients, or add a Bcc: header and submit
>the message directly to sendmail with the -t operand.  Either way, only one
>message is sent to multiple users, which should be considerably more efficient
>and will certainly require less processes.

[FEWER processes]

If this successfully supresses the headers, great.  I suspect it might
require BCC: to do it.  An alternative might be to use the "-v" option
on mail.  That will cause /usr/ucb/mail to wait until the mail is actually
delivered or queued before exiting.  The disadvantage to this is that it
can take quite a while if hosts are not answering.  I usually stuff this
into the background anyway (logging output to a temp file, too).

Neil, can you confirm which of your methods actually avoids sending all
the headers to recipients?  I might like to use your ideas if so.
-- 
 /***************************************************************************\
/ Phil Howard -- KA9WGN -- phil at ux1.cso.uiuc.edu                              \
\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks                             /
 \***************************************************************************/



More information about the Comp.unix.questions mailing list