Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!husc6!ogccse!littlei!omepd!merlyn From: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Newsgroups: comp.unix.questions Subject: Re: Some csh how-to, please Keywords: csh C-shell shell programming unix read Message-ID: <4258@omepd.UUCP> Date: 30 Mar 89 19:29:13 GMT References: <2127@pikes.Colorado.EDU> <7467@thorin.cs.unc.edu> <1175@Portia.Stanford.EDU> Sender: news@omepd.UUCP Reply-To: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Organization: Stonehenge; netaccess via BiiN, Hillsboro, Oregon, USA Lines: 38 In-reply-to: karish@forel.stanford.edu (Chuck Karish) In article <1175@Portia.Stanford.EDU>, karish@forel (Chuck Karish) writes: | [ a lot of stuff deleted] | An sh script to do this job would look like | | cat file | | while read fie | do | echo A $fie | done | | No magic cookies needed; 'read fie' fails at EOF. | A pipe or redirect after 'done' receives the entire output of the loop. | | csh is OK as an interactive command line interpreter. As a programming | language, it's not so hot. My advice would be to get a copy of | Kernighan and Pike, and use sh instead. Why do people use 'cat' at every opportunity? Maybe that's why they sell so many multiprocessor machines? :-) :-) Simpler: while read fie do something with $fie done ...!uunet!tektronix!biin!merlyn | \ Cute quote: "Welcome to Oregon... home of the California Raisins!" /