On 1/4/11 10:35 AM, Eric Blake wrote: >> The shell should not exit on an assignment error with getopts, since >> getopts is not a special builtin. > > Good point - 'unset' is different than 'getopts' or 'read' when it comes > to special builtin status, and I agree that only special builtins are > allowed to exit a non-interactive shell on an assignment error (POSIX > XBD 2.8.1 Consequences of Shell Errors). Even worse, neither ksh nor > bash exit the shell on 'readonly foo; unset foo; echo $?', so ksh's > behavior on 'getopts' seems like a ksh bug.
Unsetting a readonly variable does not constitute an assignment error or a so-called `operand error'. Nor is it a syntax error. `unset' should return a non-zero status, since the variable could not be unset, but not cause the shell to abort. 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/