bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: param expansion with single-character special vars in the environmen


From: Eduardo A . Bustamante López
Subject: Re: param expansion with single-character special vars in the environment
Date: Wed, 27 Apr 2016 14:10:50 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Apr 25, 2016 at 03:48:17PM -0400, Grisha Levit wrote:
> There seems to be a bug that if an array variable with a name matching one
> of the special single-character variables exists, then that variable is
> used during substring expansion and parameter transformation.
[...]
> # Expected behavior:set -- 1 2 3echo ${@@A}     # set -- '1' '2'
> '3'echo ${@:0}     # bash 1 2 3
[...]

This is actually expected behaviour. The @ parameter is a special case, with $0
being argv[0]. Normally, if you do "$@" it will expand to "$1" "$2" ... "$n",
without including $0. But in this case you're forcing it to expand from $0.

-- 
Eduardo Bustamante
https://dualbus.me/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]