|
@@ -17,20 +17,16 @@ cp "$db_file" "$db_file.backup"
|
|
|
#
|
|
|
# Name: Som E. Name
|
|
|
# Email: address@example.com
|
|
|
-mapfile -t contacts < <(find ${form_dir} -type f -name "*.txt" -exec awk -F ":" '
|
|
|
+mapfile -t contacts < <(grep -Fxf- -v "$excluded" < <(find ${form_dir} -type f -name "*.txt" -exec awk -F ":" '
|
|
|
/Name:/ { name = $2 } /Email:/ { email = $2 } END {
|
|
|
printf "%s <%s>\n", substr(name,2), substr(email,2)
|
|
|
}
|
|
|
-' {} \;)
|
|
|
+' {} \;))
|
|
|
|
|
|
|
|
|
# Loop through the contacts array and add each contact to the mailing list
|
|
|
for contact_email in "${contacts[@]}"; do
|
|
|
|
|
|
- # check exclusions
|
|
|
- grep -Fx "$contact_email" >/dev/null < "$excluded" && echo "Skipped (excluded): '$contact_email'" && continue
|
|
|
-
|
|
|
-
|
|
|
# Use sqlite3 to add the contact to the mailing list
|
|
|
#set -x
|
|
|
exists=$(sqlite3 "$db_file" <<EOF
|