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.
Whe
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.
$ cat /tmp/s
fun() { declare -p BASH_ARGC BASH_ARGV; }
fun arg
$ shopt -u extdebug; source /tmp/s
declare -a BASH_ARGC=([0]="1")
declare -a BASH_ARGV=([0]="/tmp/s")
$