Problems that need counting (was Re: Bourne Shell (/bin/sh) counting?)
Martin Weitzel
martin at mwtech.UUCP
Wed Mar 21 07:13:59 AEST 1990
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 at mwtech.UUCP, voice: 49-(0)6151-6 56 83
More information about the Comp.unix.questions
mailing list