Re: [PATCH] Add @R parameter transform to reverse expansion order
From:
Greg Wooledge
Subject:
Re: [PATCH] Add @R parameter transform to reverse expansion order
Date:
Thu, 28 May 2026 09:19:09 -0400
User-agent:
Mutt/1.10.1 (2018-07-13)
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.