Tek-tips.com helped provide this solution.. FYI:
set -- ${arrayA[@]} # set positional parameters to elements of arrayA
integer subb=0
for i in $@ # for each parameter (ie $1 $2 $3 ...)
do
subb=0
while : #endless loop
do
# if there is a match, we want to drop this element
[[ $i = ${arrayB[subb]} ]] &&
break #jump out of THIS loop
(( subb += 1 ))
#if we've tested all elements of arrayB, then we have no match
[[ $subb -ge ${#arrayB[*]} ]] &&
{
#so we build a new variable containing all elements of arrayA that we want to keep.
NewString=" $NewString $i"
break
}
done
done
set -A arrayA $NewString # recreate arrayA
${#arrayB[*]} evaluates to number of array elements
${arrayA[@]} evaluates to all array elements
${arrayA[*]} evaluates to all array elements
${arrayB[subb]} evaluates to the array element indexed by $subb
Once you have created an array, you cannot "remove" any elements, or insert any new ones.