[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Passing multiple arrays to a function
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] Passing multiple arrays to a function |
Date: |
Thu, 14 Feb 2019 08:15:25 -0500 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Wed, Feb 13, 2019 at 07:01:10PM +0300, Dmitry Alexandrov wrote:
> safe-fn ()
> {
> local a=("${!1}") b=("${!2}")
> local array_1=('FAIL')
> printf '%s;' "address@hidden" "address@hidden"
> printf '\n'
> }
>
> safe-fn 'address@hidden' 'address@hidden'
Oh my gods, it's *THAT* hack again.
I don't know where it came from (other than "try a bunch of shit and
see if it works"), or how it got such a foothold in people's minds.
I have nothing good to say about that hack. At some point a couple
years ago, we asked Chet whether it was actually a supported thing,
or whether a future bug-fix of the parser might make it stop behaving
this way, and the answer was inconclusive.
In any case, you are not using namerefs here, so my warnings about
nameref collisions simply do not apply.