I thought I'd illustrate the problem. Given a #!/bin/sh script like this
called tst:

    #!/bin/sh
    f()
    {
        local v="$@"
        echo "<$V>"
    }
    f "$@"

On Debian, Fedora, FreeBSD, OpenBSD, macOS, and Solaris, the arguably incorrect
but more useful behaviour is:

    > ./tst a b c
    <a b c>
    > ./tst 1 2 3
    <1 2 3>

On Ubuntu, the arguably correct but less useful behaviour is:

    > ./tst a b c
    <a>
    > ./tst 1 2 3
    ./tst: 4: local: 2: bad variable name

On NetBSD, the behaviour is very similar to Ubuntu's, but not identical:

    > ./tst a b c
    <a>
    > ./tst 1 2 3
    local: 2: bad variable name
    <1>

It seems that "bad variable name" is a fatal error on Ubuntu, but not on
NetBSD.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1943964

Title:
  local var="$@" doesn't behave like every other system

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dash/+bug/1943964/+subscriptions


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

Reply via email to