[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some Special Array Variables Only Kind Of Initialized
From: |
Chet Ramey |
Subject: |
Re: Some Special Array Variables Only Kind Of Initialized |
Date: |
Sat, 11 Jan 2014 16:55:44 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 1/10/14, 6:06 PM, John R. Graham wrote:
> Some of the automagically created special array variables (GROUPS and
> DIRSTACK for soer; perhaps others) appear to not be fully initialized. Their
> values don't appear correctly in some corner cases until they've been
> referenced with parameter expansion (I think that's the triggering criteria,
> anyway). The following shell dialog illustrates:
Yes. There are a number of dynamic variables whose values are generated
each time they are referenced. In most cases, they have no values until
the value is generated the first time.
Here's a partial list from bash-4.3:
BASH_COMMAND
BASH_SUBSHELL
RANDOM
SECONDS
LINENO
BASHPID
COMP_WORDBREAKS
DIRSTACK
GROUPS
FUNCNAME
BASH_ARGC
BASH_ARGV
BASH_SOURCE
BASH_LINENO
BASH_CMDS
BASH_ALIASES
Chet
--
``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/