Re: [PATCH] Add @R parameter transform to reverse expansion order

Greg Wooledge <[email protected]> Thu, 28 May 2026 09:19:09 -0400
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <[email protected]>
On Thu, May 28, 2026 at 14:23:53 +0200, Félix Hauri via Bug reports for the GNU Bourne Again SHell wrote:
> Currently, I use extdebug in order to avoid loop for this:
> 
>   revArray() { 
>     function _funcRevArray() { 
>         local -n _fRevVar=$1
>         shift
>         _fRevVar=("${BASH_ARGV[@]::$#}")
>     }
>     local -n _revVarCnt=$1
>     local _revVarName=$1
>     shift
>     shopt -s extdebug
>     _funcRevArray "$_revVarName" "${_revVarCnt[@]}"
>     shopt -u extdebug
>   }

The manual (under BASH_ARGV) says "Setting extdebug after the shell has
started to execute a script, or referencing this variable when extdebug
is not set, may result in inconsistent values."

I don't doubt that it's working for you, but that wording worries me.