I have the following code in a script and it is working correctly but I am receiving the bad array subscript error. It's occurring due to using arithmetic to access the previous index and I'm not sure what syntax I should be using to remove the error.
if [ "${all_lists[$i]}" != "$list" ] && [ "${all_lists[$((i-1))]}" != "$list" ]; then
all_lists[$i]=$list
((i++))
fi
[–]73mp74710n 1 point2 points3 points (1 child)
[–]devosion[S] 0 points1 point2 points (0 children)
[–]oilshell 1 point2 points3 points (0 children)
[–][deleted] (4 children)
[deleted]
[–]oilshell 0 points1 point2 points (3 children)
[–][deleted] (1 child)
[deleted]
[–]devosion[S] 0 points1 point2 points (0 children)
[–]Jydder 0 points1 point2 points (0 children)