arr1 contains elements "a" "b" "c"
arr2 contains element "b"
if elements of arr2 exist in arr1, then do....
How would I write this?
something along the lines of
for x in arr1
do
if [ ${arr1[x]} == ${arr2[*]} ]
then ...
fi
done
?
arr1 contains elements "a" "b" "c"
arr2 contains element "b"
if elements of arr2 exist in arr1, then do....
How would I write this?
something along the lines of
for x in arr1
do
if [ ${arr1[x]} == ${arr2[*]} ]
then ...
fi
done
?
Checking values in arr2 present in arr1 :
arr1=("a" "b" "c")
arr2=("c" "d" "e")
for i in "${arr2[@]}"
do
for j in "${arr1[@]}"
do
[[ "$i" == "$j" ]] && echo "$i"
done
done
--> prints : c