Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS: -O2 -march=native -pipe -Wno-parentheses 
-Wno-format-security
uname output: Linux sun 5.9.0-gentoo-k8s #1 SMP PREEMPT Tue Oct 13 23:59:55 
CEST 2020 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 18
Release Status: release

Description:
This worked just fine on Bash 4.2:

foo() {
    local -a args=("${!1}")
    echo "[IN] ${args[@]}"
}

declare -a args=("$@")
echo "Bash ${BASH_VERSION}"
echo "[OUT] ${args[@]}"
foo args[@]

eg.
$ ./test.sh 1 2 3
Bash 4.2.46(2)-release
[OUT] 1 2 3
[IN] 1 2 3
whereas on Bash 5.0 we get:
$ ./test.sh 1 2 3
Bash 5.0.18(1)-release
[OUT] 1 2 3
[IN]

Renaming local variable args (in foo) to something else also gives expected 
results.

Reply via email to