* chuli <[EMAIL PROTECTED]> [2007-12-25 09:42]:
> Hello, everyone
> 
>       When I use such script with ksh, it will produced "Segment fault!"
> But when I use it with bash, it will output normally. Why does ksh print 
> "Segment fault"? 
> for((;i<10;i++))
> do
>   echo $i -----> or just use "$i" here
> done
> "

The man page says:

  for (( [expr1] ; [expr2] ; [expr3] )) ;do list ;done
              The  arithmetic  expression expr1 is evaluated first

So you need to initialize your i

        (( i=0; i < 10, i++ ))

If you do:

while (( z < 10 )) 
do
        ...

And you don't initialize your z you'll get the same thing!

ksh prints "Segment fault" or "Bus error" on Version M 1993-12-28 p on Mac OS X 
because i is not initialized!

Jerry




_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to