On Wed, October 14, 2009 11:11 pm, igor denisov wrote: > Hi there > > my version of ksh: > > $what /bin/ksh > > /bin/ksh > Copyright (c) 1989, 1993 > $OpenBSD: mknod.c,v 1.1 2005/10/06 06:39:36 otto Exp $ > PD KSH v5.2.14 99/07/13.2 > > I cannot figure out what is wrong with the following code > > #! /bin/ksh > for (( i=9; i>0; i-- )) > do echo "$i" > done > > output: > syntax error: '((' unexpected. > why? > regards > -- > igor denisov.
OpenBSD's ksh does not support that syntax for 'for': for name [in word ...]; do list; done For each word in the specified word list, the parameter name is set to the word and list is executed. If in is not used to spec- ify a word list, the positional parameters ($1, $2, etc.) are used instead. For historical reasons, open and close braces may be used instead of do and done e.g. for i; { echo $i; }. The ex- it status of a for statement is the last exit status of list; if list is never executed, the exit status is zero. -- Joe Gidi j...@entropicblur.com