Bash arrays and negative subscripts, yes or no?

后端 未结 5 2035
感动是毒
感动是毒 2021-02-08 00:32

The GNU bash manual tells me

An indexed array is created automatically if any variable is assigned to using the syntax

name[subscript]=v         


        
5条回答
  •  生来不讨喜
    2021-02-08 00:45

    The negative subscript works perfectly fine for me on my computer with Ubuntu 14.04 / GNU bash version 4.3.11(1) however it returns:

    line 46: [-1]: bad array subscript
    

    When I try to run the same script on 4.2.46(1). I

提交回复
热议问题