Move under www to ease rsync

This commit is contained in:
2025-10-29 10:51:15 +01:00
parent 2bb22c7583
commit 30ad62e938
890 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
#!/bin/bash
#
# Check that the data file exists
#
data="bash13_ex4.txt"
[ -e "$data" ] || { echo "File $data not found"; exit 1; }
#
# Email addresses can be:
# 1. local-part@domain
# 2. Name <local-part@domain>
#
part1='([a-zA-Z0-9_][a-zA-Z0-9_.]+@[a-zA-Z0-9.-]+)'
part2='([^<]+)<([a-zA-Z0-9_][a-zA-Z0-9_.]+@[a-zA-Z0-9.-]+)>'
re="^($part1|$part2)$"
#
# Read and check each line from the file
#
while read -r line; do
#
# Does it match the regular expression?
#
if [[ $line =~ $re ]]; then
#declare -p BASH_REMATCH
#
# Decide which format it is depending on whether element 2 of
# BASH_REMATCH is zero length
#
if [[ -z ${BASH_REMATCH[2]} ]]; then
# Type 2
name="${BASH_REMATCH[3]}"
email="${BASH_REMATCH[4]}"
else
# Type 1
name=
email="${BASH_REMATCH[2]}"
fi
echo "Name: $name"
echo "Email: $email"
else
echo "Not recognised: $line"
fi
echo
done < "$data"