bug-bash
[Top][All Lists]
Advanced

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

Re: bug using for i in ...


From: Francis Montagnac
Subject: Re: bug using for i in ...
Date: 21 Sep 2001 15:44:48 GMT

>> Description:
>>         Using:
>>  for i in list; do echo $i; done
>>         returns an error when the list is empty.

> Sorry, it's not a bug, it's bad programming style.
> You have to check wether the list is empty or not:

I disagree.

list=""; for i in $list; do echo $i; done

works as expected, Ie: doesn't apply the body of the loop to anything
because list is empty.

-- 
Francis.Montagnac@sophia.inria.fr, Tel: (33) 04 92 38 79 11, Bur: E106
INRIA Sophia, 2004, rte des Lucioles, B.P.93 - 06902 Sophia Antipolis Cedex



reply via email to

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