문제

Say I have an array arr and an index x. How do I assign something to the array at index x+1? I'm getting bugs by trying the following, if one of them is correct I'd love to know which one and if not what am I doing wrong?

arr[$x+1]="hi"      # Doesn't work
arr[$((x+1))]="hi"  # Nope
도움이 되었습니까?

해결책

Almost there.

arr[(($x+1))]="hi"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top