Marc Weber wrote:
> Hi,
>
> I stumbled about another bash problem today:
>
> for item in $(false);
> echo $item
> done || { echo for failed; }
>
> doesn't fail. I think it's bad that there is no
> set -e
>
> like switch which really catches all failures of this kind.
This isn't really about set -e or ||; the for loop doesn't fail.
Posix.2 says, in part,
"[T]he list of words following in shall be expanded to generate
a list of items...If there are no items, the exit status shall
be zero."
http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04_03
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/