bug-bash
[Top][All Lists]
Advanced

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

BASH_ARG{C,V} set when sourcing, even without extdebug


From: Grisha Levit
Subject: BASH_ARG{C,V} set when sourcing, even without extdebug
Date: Mon, 9 Nov 2015 22:59:50 -0800 (PST)
User-agent: G2/1.0

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")

$ shopt- u extdebug; source /tmp/s foo
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()


reply via email to

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