I think by for [[s in $subj] && [s1 in $subj1]]
you mean this:
for s in $subj; do
for s1 in $subj1; do
# do something
done
done
By nesting the for
loops you'll loop through every possible combination of s
and s1
, which sounds like what you're trying to do in part 1 of your question.
However, I can't make sense of what you're talking about in part 2, so I can't help you there.