]> git.donarmstrong.com Git - debian/debian-policy.git/commitdiff
local must support multiple variables and assignment
authorRuss Allbery <rra@debian.org>
Sat, 5 Jul 2008 20:28:06 +0000 (13:28 -0700)
committerRuss Allbery <rra@debian.org>
Sat, 5 Jul 2008 20:28:06 +0000 (13:28 -0700)
All Bourne-type shells in Debian support localizing multiple variables
in one command, and all except posh support assignment.  Supporting
multiple variables and assignment brings the behavior of local in line
with export and readonly.  Permit /bin/sh scripts to assume that local
can take multiple variables and assignment.

Closes: Bug#473019
policy.sgml

index c9bd84f23d9057d7825af62d195a88cf7866ff46..2bc0d933d7cbc43388370309e29ccb99667e954f 100644 (file)
@@ -7040,18 +7040,19 @@ strip --strip-unneeded <var>your-lib</var>
              support <tt>-a</tt> and <tt>-o</tt> as binary logical
              operators.</item>
            <item><tt>local</tt> to create a scoped variable must be
-             supported; however, <tt>local</tt> may or may not preserve
-             the variable value from an outer scope and may or may not
-             support arguments more complex than simple variables.  Only
-             uses such as:
+             supported, including listing multiple variables in a single
+             local command and assigning a value to a variable at the
+             same time as localizing it.  <tt>local</tt> may or
+             may not preserve the variable value from an outer scope if
+             no assignment is present.  Uses such as:
 <example compact>
 fname () {
-    local a
-    a=''
-    # ... use a ...
+    local a b c=delta d
+    # ... use a, b, c, d ...
 }
 </example>
-              must be supported.
+             must be supported and must set the value of <tt>c</tt> to
+             <tt>delta</tt>.
             </item>
          </list>
          If a shell script requires non-SUSv3 features from the shell