Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!ux1.cso.uiuc.edu!phil From: phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) Newsgroups: comp.unix.questions Subject: Re: Csh & foreach causing fork problems Message-ID: <1991Mar25.231212.9299@ux1.cso.uiuc.edu> Date: 25 Mar 91 23:12:12 GMT References: <1991Mar24.201730.14808@aucs.AcadiaU.ca> <1991Mar24.211458.6525@mp.cs.niu.edu> Organization: University of Illinois at Urbana Lines: 40 rickert@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@ux1.cso.uiuc.edu \ \ Lietuva laisva -- Brivu Latviju -- Eesti vabaks / \***************************************************************************/