Some csh how-to, please

Randal L. Schwartz @ Stonehenge merlyn at intelob.intel.com
Fri Mar 31 05:29:13 AEST 1989


In article <1175 at Portia.Stanford.EDU>, karish at 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 <file

no additional processes.

I agree about sh vs csh.  But I won't get started in *that* religious
war.  Get ksh... the best of both worlds (hee hee)...

A unix wizard (or one that plays one on TV...),
-- 
/     Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095        \
|        on contract to BiiN (for now :-) Hillsboro, Oregon, USA.             |
|<@intel-iwarp.arpa:merlyn at intelob.intel.com> ...!uunet!tektronix!biin!merlyn |
\     Cute quote: "Welcome to Oregon... home of the California Raisins!"      /



More information about the Comp.unix.questions mailing list