Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!spool.mu.edu!news.cs.indiana.edu!nstn.ns.ca!aucs.acadiau.ca!880274d From: 880274d@aucs.AcadiaU.ca (Ralph Doncaster) Newsgroups: comp.unix.questions Subject: Csh & foreach causing fork problems Message-ID: <1991Mar24.201730.14808@aucs.AcadiaU.ca> Date: 24 Mar 91 20:17:30 GMT Reply-To: 880274d@aucs.acadiau.ca (Ralph Doncaster) Organization: School of Computer Science, Acadia Univ., Nova Scotia Lines: 26 I'm having problems with a script I made to mail all the students on our system. I often get a "fork: no more processes" error. I assume this is because foreach starts a new process for each argument it is given. How can I solve this problem? Here is the script: #!/bin/csh # bm (batch mailer) by Ralph Doncaster, Jan 25/91 # script to mail message to all accounts in /u/student # usage: bm subject file if ($#argv) then foreach i(`/bin/ls /u/student`) mail -s $1 $i < $2 sleep 1 end echo "Sending message file " $1 "to all accounts in /u/student." else echo "Usage: bm subject file" endif -- +---------------------------------------------------------------------------+ |Ralph Doncaster I don't have anything interesting to put in my .sig | |880274d@AcadiaU.CA 330 CHI, Acadia U., Wolfville, NS B0P 1X0 542-3010 | |UUCP: {uunet|watmath|utai}!cs.dal.ca!aucs!880274d BITNET: 880274d@Acadia | +---------------------------------------------------------------------------+