[petsc-dev] do syntax
Satish Balay
balay at mcs.anl.gov
Wed Mar 3 00:24:13 CST 2010
On Tue, 2 Mar 2010, Jed Brown wrote:
> On Tue, 2 Mar 2010 07:32:16 -0600, Barry Smith <bsmith at mcs.anl.gov> wrote:
> >
> > >>> $ for i in {1..5}; do
> > >>>> echo $i
> > >>>> done
> > >>> {1..5}
> >
> >
> > This notation does not appear to be portable to sh, so we've had to
> > change it back to listing 1 2 etc.
>
> "seq" is more common than bash
>
> for i in `seq 1 5`; do
>
> but still not available everywhere.
yes - seq is not available on freebsd [so we have to use "for i in 1 2 3 4 5; do"
> On this note, I see the use of
> $[expr] which is definitely less portable than $((expr)), but neither of
> which are mandated. I suppose the arithmetic could be done with "bc",
> which at least is part of POSIX. Or with python -c ...
count=`expr $count + 1` works portably [there is already some code
using this notation] - so I just pushed this fix..
Satish
>
> Jed
>
More information about the petsc-dev
mailing list