Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!gatech!mcnc!duke!bet From: bet@orion.mc.duke.edu (Bennett Todd) Newsgroups: comp.unix.wizards Subject: Re: csh problem involving nested ifs? Message-ID: <15004@duke.cs.duke.edu> Date: 17 Jul 89 19:50:58 GMT References: <20243@adm.BRL.MIL> <5016@ficc.uu.net> <3171@quick.COM> Sender: news@duke.cs.duke.edu Reply-To: bet@orion.mc.duke.edu (Bennett Todd) Organization: Diagnostic Physics, Radiology, DUMC Lines: 54 In-reply-to: srg@quick.COM (Spencer Garrett) In article <3171@quick.COM>, srg@quick (Spencer Garrett) writes: >In article <5016@ficc.uu.net>, peter@ficc.uu.net (Peter da Silva) writes: > >-> generate_a_list_of_file_names | >-> while read FNAME >-> do >-> do_something_with FNAME >-> done >-> >-> is second nature. And it's impossible in csh without massive inconvenience. >-> By comparison, having TEST and EXPR builtin is a minor optimisation. > >What are you talking about? It's easy and much more natural under csh. > >foreach fname (`generate_a_list_of_file_names`) > do_something_with_fname >end I am *so* glad bash is out; I used to use a C-shell for interactive work just to get history and job control; I was always having to fire up /bin/sh to do serious looping work. Here are some things csh croaks on: find ... -print | while read filename;do ... done If you try rewrite that as foreach f (`find ... -print`) ... end csh will bomb on command line too long. IFS=: while read login passwd uid gid gcos home shell;do # process /etc/passwd with fields broken down done