> No, a seg fault in a shell is always a bug. The above bug is fixed in > the latest ksh version.
My ksh is Version M 1993-12-28 r. Has it been fixed in ksh93 s+? Regards Chuli > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Bernd Eggink > Sent: Tuesday, December 25, 2007 7:49 PM > To: [email protected] > Subject: Re: [ast-users]Segment fault in for command > > Jerry Rocteur schrieb: > > * 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 > > No, you don't. An unitialized variable in an arithmetic expression is > treated as zero. > > > (( 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! > > No, a seg fault in a shell is always a bug. The above bug is fixed in > the latest ksh version. > > Greetings, > Bernd > > -- > Bernd Eggink > [EMAIL PROTECTED] > http://sudrala.de > _______________________________________________ > ast-users mailing list > [email protected] > https://mailman.research.att.com/mailman/listinfo/ast-users _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
