This is the mail archive of the
mailing list for the Cygwin project.
Re: behaviour of "for (( exp1; exp2; exp3 )); do COMMANDS; done"
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 27 May 2003 10:05:47 +0200
- Subject: Re: behaviour of "for (( exp1; exp2; exp3 )); do COMMANDS; done"
- References: <PHENJGDFMJPEBOBLGEMOCENMCBAA.firstname.lastname@example.org>
- Reply-to: cygwin at cygwin dot com
On Tue, May 27, 2003 at 09:56:37AM +0200, Peter Oosterlynck wrote:
> When using a line like "for (( i=1 ; i<=5 ; i+=1 )); do echo $i; done" in a bash script one expects to get a list of figures ranging from 1 to 5 right?
> I've never had problems with such constructs on my Linux machine but when doing this in a cygwin bash shell, then it works fine when typed in at the command line but fails with a syntax error "Bad for loop variable" when executed in a script.
> Where did I go wrong? Ideas anybody?
Yes, you're using the `for' as in a tcsh. bash has not csh but sh syntax.
Try `man bash'.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:email@example.com
Red Hat, Inc.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html