It seems ksh does not treat unset positional parameters like "$1" as an error while using the "-u" or "nounset" option.
Here's a test script which shows the behaviour for undefined positional parameters I've tried this with ksh versions from 2011 onwards and the behaviour is same.(2011-02-08, 2012-08-01, 2013-10-10 $ cat test.ksh #!/bin/ksh93 -u arg1=$1 echo "This message should not be printed unless there is an argument to this script." $ ./test.ksh This message should not be printed unless there is an argument to this script. $ Browsing through the Changelog, I see that there is an old reference which might be related. 09-05-12 To conform with POSIX, the -u option only checks for unset variables and subscript elements rather than checking for all parameters. Also from the opengroup shell specification for the -u option given below, it looks like it might be a bug. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25 *-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.Could someone please confirm whether this is is a bug. Thanks, Lijo
_______________________________________________ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users