SUMMARY Re: sh loop variable and "double indirection"
Steve "daffy" Hunt
steve at acorn.co.uk
Tue Feb 12 05:11:45 AEST 1991
In article <1991Feb5.003613.21081 at shibaya.lonestar.org> afc at shibaya.lonestar.org (Augustine Cano) writes:
>
>
>I didn't anticipate the great response I got to my questions. This
>newsgroup is an important resource. Many thanks to the following people,
>whose summary of responses follow:
... more deleted...
I only just subscribed to this newsgroup, so this is rather late, but
my favourite solution to the loop index problem is the following shell
function (just inline it if your shell does not support functions).
# usage: range start end [step]
range () {
echo "[li p ${3-1} + d si $2!<a] sa ${1}silax" | dc
}
I don't guarantee that your version of dc will be happy with that, but
it works for me! Making it count backwards, etc, is left as an exercise.
Steve
--
Steve Hunt steve at acorn.co.uk
More information about the Comp.unix.shell
mailing list