Remove an element from a Bash array
09:32 31 May 2013

I need to remove an element from an array in bash shell. Generally I'd simply do:

array=("${(@)array:#}")

Unfortunately the element I want to remove is a variable so I can't use the previous command. Down here an example:

array+=(pluto)
array+=(pippo)
delete=(pluto)
array( ${array[@]/$delete} ) -> but clearly doesn't work because of {}

Any idea?

arrays bash variables