"local" will not be removed from dash, as it is used too much, even
though it is not in POSIX.

The underlying problem is related to a feature in bash which also
applies to some POSIX special builtins (export and readonly). This
feature is not in POSIX and strictly speaking conflicts with it.

Dash expands your local y=$x to local y=1 2 3, so three parameters for
local. It fails because "2" is not a valid variable name. Bash does not
perform field splitting and pathname generation on words that look like
assignments, if given as argument to certain builtins such as export,
readonly and local, so that the command does what you want. You can
write local y="$x" to do this in a portable manner. Alternatively, first
make the variable local, and then assign the value.

-- 
dash 0.5.3-5ubuntu2 variable expansion error using local
https://bugs.launchpad.net/bugs/139097
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to