0

I have an array full of names that I created from a file(via for loop). There are a few names that I do not want to include so removed them by doing this:

names=("${names[@]/randomName}")

This, however, does NOT remove the element. It simply removes the value of the element, leaving an empty space behind.

I've tried using the unset command with no success(trying to remove all elements with an empty space but I'm sure I'm doing it wrong)

unset 'names[${names[@]/ /}]'

My question is is how should I go about this?

0 Answers0