aboutsummaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-06-18 13:25:03 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-06-18 13:25:03 +0000
commitabae4fe16e26cf027e7c8165d27b93d74bbd18b2 (patch)
tree811bae4da4a0b6f0b370334a7f01ee5d9b9c8baf /README
parent5c44b0a472c6e9efdec28ef03337c484b1bc3ce1 (diff)
downloadzsh-abae4fe16e26cf027e7c8165d27b93d74bbd18b2.tar.gz
zsh-abae4fe16e26cf027e7c8165d27b93d74bbd18b2.tar.xz
zsh-abae4fe16e26cf027e7c8165d27b93d74bbd18b2.zip
23562: add KSH_ZERO_SUBSCRIPT option and leave off by default
Diffstat (limited to 'README')
-rw-r--r--README29
1 files changed, 25 insertions, 4 deletions
diff --git a/README b/README
index 034f5f39a..f8a7cf241 100644
--- a/README
+++ b/README
@@ -45,6 +45,31 @@ behaviour.) Now it is treated identically to "$@". The same change
applies to expressions with forced splitting such as ${=1+"$@"}, but
otherwise the case where SH_WORD_SPLIT is not set is unaffected.
+In previous versions of the shell it was possible to use index 0 in an
+array or string subscript to refer to the same element as index 1 if the
+option KSH_ARRAYS was not in effect. This was a limited approximation to
+the full KSH_ARRAYS handling and so was not very useful. In this version
+of the shell, this behaviour is only provided when the option
+KSH_ZERO_SUBSCRIPT is set. Note that despite the name this does not provide
+true compatibility with ksh or other shells and KSH_ARRAYS should still be
+used for that purpose. By default, the option is not set; an array
+subscript that evaluates to 0 returns an empty string or array element and
+attempts to write to an array or string range including only a zero
+subscript are treated as an error. Writes to otherwise valid ranges that
+also include index zero are allowed; hence for example the assignment
+ array[(R)notfound,(r)notfound]=()
+(where the string "notfound" does not match an element in $array) sets the
+entire array to be empty, as in previous versions of the shell.
+KSH_ZERO_SUBSCRIPT is irrelevant when KSH_ARRAYS is set. Also as in previous
+versions, attempts to write to non-existent elements at the end of an array
+cause the array to be suitably extended. This difference means that, for
+example
+ array[(R)notfound]=(replacement)
+is an error if KSH_ZERO_SUBSCRIPT is not set (new behaviour), while
+ array[(r)notfound]=(replacement)
+causes the given value to be appended to the array (same behaviour as
+previous versions).
+
The "exec" precommand modifier now takes various options for compatibility
with other shells. This means that whereas "exec -prog" previously
tried to execute a command name "-prog", it will now report an error
@@ -77,10 +102,6 @@ of the value. The form ${param//#$search/replace} where the value
$search starts with "%" considers the "%" to be part of the search
string as before.
-Parameter subscripts of the form ${array[(R)test]} now return the
-empty string if they fail to match. The previous longstanding behaviour
-was confusing and useless.
-
The MULTIBYTE option is on by default where it is available; this
causes many operations to recognise characters as in the current locale.
Older versions of the shell always assumed a character was one byte.