[Top][All Lists]

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

Re: BASH_ARGC and BASH_ARGV are empty

From: Chet Ramey
Subject: Re: BASH_ARGC and BASH_ARGV are empty
Date: Thu, 17 Feb 2005 20:55:25 -0500
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

address@hidden wrote:
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib  -D_FILE_OFFSET_BITS=64 -O2 -g 
-pipe -m32 -march=i386 -mtune=pentium4
uname output: Linux nypagt01.openfinance.com 2.6.9-1.667smp #1 SMP Tue Nov 2 
14:59:52 EST 2004 i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu

Bash Version: 3.0
Patch Level: 14
Release Status: release

I am trying to get the values of BASH_ARGC and BASH_ARGV, but they
seem to be empty? Is it a bug, feature, my misunderstanding, or a configuration issue.

Run the following script:

---------------CUT HERE----------------
function a
    echo "a args: $@"
    b calling function b
function b
    echo "b args: $@"
    set|grep ARG;
#    for ((i=0 ; $i < address@hidden ; i++))
#    do
#        printf "%s[%s](" "${FUNCNAME[$i]}" "${BASH_ARGC[$i]}";
#        printf "%s)\n" "${BASH_ARGV[*]}";
#    done

a calling function a
---------------CUT HERE----------------

And the output I get is

    set | grep ARG

Shouldn't BASH_ARGC be something like ([0]=>3, [1]=>3)
and BASH_ARGV contain words "calling function b calling function a"?
FUNCNAME correctly returns "b a"

BASH_ARGC and BASH_ARGV are set only in `extended debug' mode;
enabled with `shopt -s extdebug'.  I will correct the omission
in the manual.


``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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