From: Russ Allbery Date: Sat, 5 Jul 2008 20:28:06 +0000 (-0700) Subject: local must support multiple variables and assignment X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c40db0098b36e609ca389897c089239116ae0d89;p=debian%2Fdebian-policy.git local must support multiple variables and assignment 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 --- diff --git a/policy.sgml b/policy.sgml index c9bd84f..2bc0d93 100644 --- a/policy.sgml +++ b/policy.sgml @@ -7040,18 +7040,19 @@ strip --strip-unneeded your-lib support -a and -o as binary logical operators. local to create a scoped variable must be - supported; however, local 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. local may or + may not preserve the variable value from an outer scope if + no assignment is present. Uses such as: fname () { - local a - a='' - # ... use a ... + local a b c=delta d + # ... use a, b, c, d ... } - must be supported. + must be supported and must set the value of c to + delta. If a shell script requires non-SUSv3 features from the shell