Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: comp.unix.questions Subject: Problems that need counting (was Re: Bourne Shell (/bin/sh) counting?) Message-ID: <686@mwtech.UUCP> Date: 20 Mar 90 21:13:59 GMT References: <22788@adm.BRL.MIL> <1990Mar19.173623.1737@iwarp.intel.com> <15270@bfmny0.UU.NET> Reply-To: martin@mwtech.UUCP (Martin Weitzel) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 28 At this time there goes a small discussion about the methods of "counting" in shell scripts. IMHO using (much) arithmetic in shell scripts is an indication that one should think about some other way to do the job. Before you flame me or mail me large scripts to show how essential counting is in *your* (Bourne) shell application please note: I don't doubt that there *are* situations for counting and other arithmetic operations in shell scripts. I only claim that there are fewer situations as you think, esp. if you were trained to work with an "ordinary" programming language, before you made the step to the shell. If you want, please post (or mail me, I'll sumarize) a short example of a shell script, which a) has a strict need to do "counting" (or other heavy use of arithmetic) b) could not easily split off (name the reasons!) the arithmetic work and leave it to some other tool like "awk", "bc" ... (Poor performance may be one such reason!) In short, the example should show that a shell 'builtin' for arithmetic were a *real* benefit for that problem. (What I don't want to see are programs to calculate the first 100 primes, print a table of sine- and cosine values etc., because that would not be typically done in a job control language like the shell.) Please do *not* post or mail the whole script! Cut out only the essential parts or only describe the problem. -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83