POSIX.1-2008 TC1 changed the behavior of "set -u" to apply to all parameters
(other than "@" and "*") instead of just variables.

POSIX.1-2008:

    -u
        The shell shall write a message to standard error when it tries to
        expand a variable that is not set and immediately exit. An interactive
        shell shall not exit.

POSIX.1-2008 TC1:

    -u
        When the shell tries to expand an unset parameter other than the '@'
        and '*' special parameters, it shall write a message to standard error
        and shall not execute the command containing the expansion, but for
        the purposes of setting the '?' special parameter and the exit status
        of the shell the command shall be treated as having been executed and
        returned an exit status of between 1 and 125 inclusive. A
        non-interactive shell shall immediately exit. An interactive shell
        shall not exit.

ksh93 2012-02-29 does not treat, e.g., the expansion of unset positional
parameters as an error, nor does it issue an error when an unset positional
parameter is used in a parameter expansion of the form "${#parameter}",
"${parameter%[word]}", "${parameter%%[word]}", "${parameter#[word]}", or
"${parameter##[word]}", for which POSIX.1-2008 TC1 states:

   If parameter is unset and set -u is in effect, the expansion shall fail.

--
Nathan Weeks
IT Specialist
USDA-ARS Corn Insects and Crop Genetics Research Unit
http://weeks.public.iastate.edu/
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to