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 c...@case.edu http://cnswww.cns.cwru.edu/~chet/