bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Empty for loops do not work in bash 2.05.8...


From: Roberto Bagnara
Subject: Empty for loops do not work in bash 2.05.8...
Date: Sat, 08 Dec 2001 13:36:08 +0100

... but they do work in version 2.04.21.

Let me start from the beginning.  I just upgraded one of my systems
from Red Hat 7.1 to 7.2 and suddenly all my automake-generated
Makefile's stopped working.  The problem can be easily exemplified
as follows:

$ bash --version
GNU bash, version 2.05.8(1)-release (i386-redhat-linux-gnu)
Copyright 2000 Free Software Foundation, Inc.
$ for k in ; do echo flip; done
bash: syntax error near unexpected token `;'
$

On a Red Hat 7.1 system I have, instead,

$ bash --version
GNU bash, version 2.04.21(1)-release (i386-redhat-linux-gnu)
Copyright 1999 Free Software Foundation, Inc.
$ for k in ; do echo flip; done
$

i.e., the loop body is executed zero times.
This observation prompted me to read the bash FAQ available at
ftp://ftp.cwru.edu/pub/bash/FAQ and especially question

  E7) What about empty for loops in Makefiles?

whose answer says, among other things,

  In versions of bash before bash-2.05a, this was a syntax error.  If the
  reserved word `in' was present, a word must follow it before the semicolon
  or newline.  The language in the manual page referring to the list of words
  being empty referred to the list after it is expanded.  These versions of
  bash required that there be at least one word following the `in' when the
  construct was parsed.

  ...

  The latest drafts of the updated POSIX standard have changed this:  the
  word list is no longer required.  Bash versions 2.05a and later accept
  the new syntax.

So, assuming that version "2.05.8(1)-release" is after "bash-2.05a"
this would seem a bug in "2.05.8(1)-release".  However, assuming
"2.04.21(1)-release" is before "bash-2.05a", this would also indicate
there is a bug in the FAQ.
Does anyone know what is happening?
Is there any workaround apart from downgrading bash?
All the best,

     Roberto

-- 
Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]