home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10075 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  1.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!bu.edu!jade.tufts.edu!news.tufts.edu!news.tufts.edu!rdorich
  2. From: rdorich@jade.tufts.edu (Rob)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: csh foreach question
  5. Message-ID: <RDORICH.92Aug13103121@jade.tufts.edu>
  6. Date: 13 Aug 92 14:41:33 GMT
  7. References: <BswB6M.Dxw@news.cso.uiuc.edu>
  8. Sender: news@news.tufts.edu (USENET News System)
  9. Organization: Tufts University - Medford, MA
  10. Lines: 21
  11. In-Reply-To: gordon@osiris.cso.uiuc.edu's message of 13 Aug 92 00:11:08 GMT
  12.  
  13. you wrote:
  14. >foreach line (`cat this_script`)
  15. >  echo "$line"
  16. >end
  17. [more]
  18.  
  19. And you were wondering why does it print one word per line.  That is
  20. the correct behaviour, foreach takes every word as an item to work
  21. with. So, for example if you do foreach i (`echo line_above`)
  22. this will be equal to foreach i (the correct behaviour....).
  23. So the loop will go throug for 'the' 'correct' ....
  24. Hope this helps
  25.  
  26. Rob
  27. --
  28.  
  29. -------------------------------------------------------------------------------
  30. Roberto Dorich           |           /~~  \ /  ~~/~~ /~~/  /~~  /|  /    /~~
  31.                          |    SKI   /--    X    /   /__/  /--  / |/ |   /--
  32. rdorich@jade.tufts.edu   |         /__    / \  /   /\    /__  /     |  /__
  33. -------------------------------------------------------------------------------
  34.