Re: test -v and environment variable names with subscripts

2018-07-19 Thread Grisha Levit
On Thu, Jul 19, 2018 at 2:44 PM konsolebox wrote: > On Wed, Jul 18, 2018 at 5:19 AM, Grisha Levit wrote: > > $ set -u; unset var; f() { test -v 'var[0]'; echo $?; }; var[0]=X f > > 0 > > -bash: var[0]: unbound variable > > I'm not getting this error. What version of bash are you using? Sorry ab

Re: test -v and environment variable names with subscripts

2018-07-19 Thread konsolebox
On Wed, Jul 18, 2018 at 5:19 AM, Grisha Levit wrote: > $ set -u; unset var; f() { test -v 'var[0]'; echo $?; }; var[0]=X f > 0 > -bash: var[0]: unbound variable I'm not getting this error. What version of bash are you using? -- konsolebox

Re: test -v and environment variable names with subscripts

2018-07-18 Thread Chet Ramey
On 7/17/18 5:19 PM, Grisha Levit wrote: > When there is a variable with a name that includes a subscript in the > environment, test -v looks at that variable rather than an array with > that subscript. Even though bash needs to do a better job to segregate environment variables with invalid names,