Re: BASH_ARG{C,V} set when sourcing, even without extdebug
From:
Chet Ramey
Subject:
Re: BASH_ARG{C,V} set when sourcing, even without extdebug
Date:
Tue, 10 Nov 2015 09:31:29 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
On 11/10/15 1:59 AM, Grisha Levit wrote:
> It looks like the source builtin pushes its own argc and argv onto the arrays
> but only if it is called with no other arguments.
Yes, bash has always done this as a convenience. This is a way to get the
name of the sourced file in the common case.
When given additional arguments, bash sets BASH_ARGC and BASH_ARGV only
when debugging mode is in effect.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/