On 7/13/12 8:53 AM, Daniel Amthor wrote: > URL: > <http://savannah.gnu.org/patch/?7818> > > Summary: Loop breaks when trying to write to a readonly > variable
Yeah, that's an assignment error. Posix says a non-interactive shell should exit in that case and that an interactive shell should write an error message without exiting. Bash doesn't exit the shell, but it does cause the current command to fail. > In a construct like this: > > var=foo > readonly var > for num in 1 2 3 4 5 > do > if [ $num -eq 3 ] > then > var=bar > fi > echo $num > done > > the loop breaks in the third round, after trying to set the r/o variable. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/