Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I want to modify an array cell, which I can do when I know the cell as a number. However here my cell position is given by $i.
$i
pomme[`${i}`]=""
I tried without the `` and it doesn't work either?
How am I suppose to do it?
pomme[$i]=""
echo $pomme[$i]
echo ${pomme[$i]}
unset pomme[$i]
pomme[$i]=("")
You don't need the quotes. Just use ${i}, or even $i:
${i}
pomme[${i}]=""
Or
Add a comment
$
a[i]
((...))
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
pomme[$i]=""should work fine..echo $pomme[$i], instead useecho ${pomme[$i]}. I guess that's why you think the value isn't updated.unset pomme[$i]if you are simply clearing, otherwisepomme[$i]=("")If you are having issue, check the value of your$i.