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

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

test -v and environment variable names with subscripts

2018-07-17 Thread Grisha Levit
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. I just posted about two ways [1] [2] to create variables like `var[0]=X' and if both of those methods are fixed than this report might be