[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: 'for f in' with empty list occers error
From:       tutimura () nn ! iij4u ! or ! jp
Date:       2002-05-30 4:33:22
Message-ID: 20020530133322B.tutimura () nn ! iij4u ! or ! jp
[Download RAW message or body]

From: prj@po.cwru.edu (Paul Jarc)
Subject: Re: 'for f in' with empty list occers error
Date: Mon, 27 May 2002 15:57:21 -0400
Message-ID: <m3g00d8itk.fsf@multivac.cwru.edu>

prj> Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp> wrote:
prj> >> $ for f in ; do echo '$f='$f; done
prj> >> bash: syntax error near unexpected token `;'
prj> >
prj> >   According to man, this should do nothing, I think.
prj> >
prj> >> If the expansion of the items following in results in an empty list,
prj> >> no commands are executed, and the return status is 0.
prj> 
prj> There's a difference between items that expand to an empty list, and
prj> no items at all.  The man page is talking about code like this:
prj> for f in $list ; do ... ; done
prj> where $list may be empty.

  Oh, I got a nice work around.

$ for f in $dummy; do ...; done

'$dummy' keeps an error away.
Thank you very much for your good hint.
-- Nobuyuki Tsuchimura


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic