+ printf "%s" "$src_file"
+}
+
+prep_sed () {
+ # Escape characters that confuse sed in a replacement string. Also replace
+ # occurences of % (which the templating uses as a variable marker) with
+ # non-printable placeholder \a (clear input of it first), to be replaced by
+ # % again when the templating has finished (so that no replacement string gets
+ # interpreted by the templating).
+ sedsafe_pattern='s/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g; $!s/$/\\/g; '
+ sed "$sedsafe_pattern" | tr -d '\a' | tr '%' '\a'