Changes
/* Search an replace - Replace a section (part) of an attribute */
Finally, we need to loop over all the lines of the result and replace a section (part) of the original (old) content to the attribute with a new section (part):
<source lang='bash'>
dn="" # Reset the dn to an empty stringcontent="" # Reset the content to an empty string
while IFS= read -r line; do
if [[ "$line" =~ ^dn.* ]]; then
dn=$line
fi
# Check, if the line starts with the ldap attribute of which we want to replace a part of the content
if [[ "$line" =~ ^${ldap_attribute}.* ]]; then
fi
done <<< "$result"
echo "Length: ${#line}"
echo "DN: $dn"
echo "Content: $content"
</source>