Problems that need counting (was Re: Bourne Shell (/bin/sh) counting?)

Maarten Litmaath maart at cs.vu.nl
Thu Mar 22 03:00:28 AEST 1990


In article <686 at mwtech.UUCP>,
	martin at mwtech.UUCP (Martin Weitzel) writes:
)... 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.

Whatever, shell arithmetic isn't that difficult to implement, it doesn't
take that much code, and it increases the elegance of scripts.  It's rather
ridiculous I have to refer to a gross construct like the following to do
some simple increment:

	i=`expr $i + 1`

I'm not solving some integral equation, you know!
The fact that `expr' maybe a built-in in modern sh versions doesn't change
my point.

It's just the whole case for shell scripts: why does one use them?
Answer: because it's ridiculous to write a C program for every little
problem!  And at that they're portable (without the fuss of recompiling).
--
 1) Will 4.5BSD have wait5()?         |Maarten Litmaath @ VU Amsterdam:
 2) Sleep(3) should be sleep(2) again.|maart at cs.vu.nl, uunet!mcsun!botter!maart



More information about the Comp.unix.questions mailing list