Hi,

try

SUM=0; for i in `seq 0 10`; do SUM=`echo "$SUM+$i"|bc`; echo -n $SUM ;done

here is the o/p...

0       1       3       6       10      15      21      28      36      45      
55      

On Tue, 15 Jan 2002, Parvez Lanewala wrote:

> hi luggers,
> 
> 
> i'm having a problem with the following code...
> 
> --snip--
> 
> for i in `seq 0 10`;
> do
>     SUM=`echo $SUM+${ARR[$i]}|bc`
> done
> 
> --snip--
> 
> error says : (standard_in) 1: parse error
> 
> although the segment 
> 
> echo $SUM+${ARR[$i]}|bc 
> 
> works fine outside the for loop. any hints on why and how i can avoid it.
> 
> thanks,
> parvez
> 
> 
> 

-- 
--Dinesh Shah :-)
Shah Micro System
[EMAIL PROTECTED]
http://dineshah.tripod.com
Mobile: 98213-11906

_______________________________________________
Meeting on 6th 4pm at IIT Mumbai. See http://www.ilug-bom.org.in/meet/
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers

Reply via email to