I have two lists.
I have to check if there is a tar.gz which name contains a substring like aa or ab and so on. I'm using this little function: How do you tell if a string contains another string in POSIX sh?
local=(aa ab ac ad ae)
remote=(ab.tar.gz ac.tar.gz ad.tar.gz ae.tar.gz af.tar.gz)
contains() { test -n "$1" || test -z "$2" && test -z "${1##*"$2"*}"; }
for le in "${local[@]}"; do
for re in "${remote[@]}"; do
contains "$re" "$le" && to_dl+=("$re")
done
done
This works well for me, but I need a second list, which contains the elements of the local list, that don't have a match in the remote list.