Score:-2

Linux bash 4.4 issue

pe flag

While executing bash script getting the below error in bash 4.4 but same working in bash 4.2

unset: [$reqStatusArrayLength-2]: bad array subscript
Artur Meinild avatar
vn flag
Bash 4.4 is included in Ubuntu 18.04, which is now end of life, and therefore off-topic here.
terdon avatar
cn flag
@ArturMeinild you can install any version of bash on any version of Ubuntu though, and the OP also mentioned 4.2, so this could just be a development environment, being used to test different bash versions.
terdon avatar
cn flag
Please [edit] your question and include the relevant part of the script so we can reproduce the error. If you are indeed using Ubuntu 18.04, then please delete and ask on [unix.se] instead. However, wherever you ask, we will need to see the script. We can't debug code we cannot see.
Artur Meinild avatar
vn flag
Of course - more details are needed indeed.
cn flag
we would need the whole script. And possibly a list of difference between 4.2 and 4.4 Does it work in 5.2?
Score:0
ca flag

Guessing as you have not shown relevant portions of your script:

Add:
echo $reqStatusArrayLength-2
just before the line where your script stops.

It is likely to print either:

  • a number LESS THAN ZERO, or
  • a number larger than the number of elements in your array

(subscript <=> index into the array).

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.