home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5560 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.2 KB  |  37 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!mcsun!sun4nl!alchemy!ruunfs!ruunfs.fys.ruu.nl!muts
  3. From: muts@fysap.fys.ruu.nl (Peter Mutsaers)
  4. Subject: Re: Simultaneous processes
  5. In-Reply-To: peter@merlin.acadiau.ca's message of 26 Aug 92 14:20:21 GMT
  6. Message-ID: <MUTS.92Aug27171737@ruunfs.fys.ruu.nl>
  7. Sender: usenet@fys.ruu.nl (News Control)
  8. Organization: Rijks Universiteit Utrecht
  9. References: <root.714838821@merlin>
  10. Date: Thu, 27 Aug 1992 15:17:40 GMT
  11. Lines: 24
  12.  
  13. >>On 26 Aug 92 14:20:21 GMT, peter@merlin.acadiau.ca (Peter Steele) said:
  14.  
  15.   Peter> How does one set up simultaneous processes in perl? For example,
  16.   Peter> how would I translate the following into perl:
  17.  
  18.   Peter>     #!/bin/sh
  19.  
  20.   Peter>     ls -la > d1 &
  21.   Peter>     ls -la > d2 &
  22.   Peter>     ls -la > d3 &
  23.   Peter>     wait
  24.   Peter>     cat d1 d2 d3 > d4
  25.  
  26. Use fork+exec to spawn, and wait to wait, something like this:
  27. fork() || (exec "ls -la > d1");
  28. fork() || (exec "ls -la > d2");
  29. fork() || (exec "ls -la > d3");
  30. wait; wait; wait;  # if there are exactly 3 childs
  31.  
  32. etc
  33. --
  34. _________________________________________________________________________
  35. Peter Mutsaers.         |================================================ 
  36. muts@fys.ruu.nl         |              Memento Mori
  37.