I am iterating through the array in shell script and when condition matches i.e. if found 'b' want to delete that element from the array. I am not using the index position to iterate through. My array has values (a b c)
My code is
for h in $Arr
do
echo -e "Value of current element $h.\n"
if [ $h == "b" ]
then
echo -e "Delete it\n"
else
echo -e "Stay here\n"
fi
done
How can I delete 'b' when condition matches so that when I print my array it should print (a c) ??