I have an array -
val=(4196976 4601313 4242010 0 3581283 2392831 3176852 3205880 3794451 0 3627872)
I am trying to find the index of all the elements whose values are equal to 0
How can i achienve this?
This is what i have tried -
for ((i = 1; i <= 10; i++)); do
if [ "$i" -eq "0" ]; then
echo "Index: $i, value: ${val[i]}"
fi
done
The output should be
Index: 3, value: 0
Index: 9, value: 0