From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pineapple.bbn.com ([128.11.0.16]) by archone.tamu.edu with SMTP id <19001>; Wed, 23 Oct 1991 12:05:34 -0500 Received: from LITCHI.BBN.COM by pineapple.bbn.com id ; Wed, 23 Oct 91 13:05:08 -0400 From: Rich Salz Received: by litchi.bbn.com id ; Wed, 23 Oct 91 13:05:05 EDT Date: Wed, 23 Oct 1991 12:05:05 -0500 Message-Id: <9110231705.AA29730@litchi.bbn.com> To: rc@archone.tamu.edu Subject: Style question, some examples I try to make all variables in my functions local; the sample below shows how I've been declaring them. Any other suggestions? I've also taken to using && and || instead of "if" -- I try to only write an "if" when I'm going to need an "else" Comments? Anyhow, here's what prompted me to write -- the following is a different version of the "src" function. The major difference is that if you have foo.y and foo.c, it will list foo.y but NOT foo.c as a source file. (It does get confused about foo.h in that case, but c'est la vie). The reason I'm sending this in is because I was pleased to figure out the ~ pattern... (Yes, old news to non-csh users, or set nonomatch :-) fn sources { *=(*.[cylh]) i=() { for (i) { switch ($i) { case *.[ylh] echo $i case *.c ~ `{basename $i .c }^.[ly] '*.[ly]' || echo $i } } } } /r$