[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange return codes of continue
From: |
Chet Ramey |
Subject: |
Re: Strange return codes of continue |
Date: |
Fri, 27 Jun 2008 15:16:47 -0400 |
User-agent: |
Thunderbird 2.0.0.14 (Macintosh/20080421) |
Roman Rakus wrote:
This is realy strange. I have two examples
First:
while [ 1 ]; do
while [ 1 ]; do
continue 0
done
done
echo $?
Second:
while [ 1 ]; do
while [ 1 ]; do
continue 0
done
echo $?
done
echo $?
In first case I have echoed 1. And I am expecting the same result in
second case, but I get 0. Can anyone help me and say where is the
difference?
It's a bug. When breaking out of multiple loops, if the outermost loop
consists of more than one command, the exit status is lost. This will
be fixed in the next release.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/