I wrote this function to print arrays in bash without using that horrible bracket syntax:
printarr()
{
arr=$1 # first argument
printf '%s\n' "${arr[@]}"
}
Does not work as expected.
It will print out the first array you feed it, but then if you feed it another array it will print out the first one again.
I call it like this
$ arr=( "single" "line" "arr" )
$ printarr $arr
$ multiarr=( "multi"
> "line"
> "arr")
$ printarr $multiarr
GNU bash, version 3.2.25(1)-release