delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/07/24/09:09:20

From: Matthias DOT Morche AT sat1 DOT de (Matthias Morche)
Subject: Re: bash-2.x
24 Jul 1998 09:09:20 -0700 :
Message-ID: <35B82892.4E065FB9.cygnus.gnu-win32@sat1.de>
References: <199807230858 DOT KAA03131 AT digicash DOT com>
Mime-Version: 1.0
To: Cygwin List <gnu-win32 AT cygnus DOT com>

Jan Nieuwenhuizen wrote:
....
>        for name [ in word; ] do list ; done
>               The list of words following in is expanded,  gener-
>               ating a list of items.  The variable name is set to
>               each element of this list in turn, and list is exe-
>               cuted  each  time.   If the in word is omitted, the
>               for command executes list once for each  positional
>               parameter  that is set (see PARAMETERS below).  The
>               return status is the exit status of the  last  com-
>               mand  that executes.  If the expansion of the items
>               following in results in an empty list, no  commands
>               are executed, and the return status is 0.
> 
> Which means that empy word-list is valid, and shouldn't trigger
> an error.
> 
>     10:55:25 mub ~/ftp/gnu/bash-2.02$ for i in ;do echo $i; done
>     bash: syntax error near unexpected token `;d'
....
An empty word list is valid, but the syntax requires not to use the "in"
keyword in that case:

for i do echo $i ; done
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019