2017-10-27 22:32:51 +00:00
|
|
|
#!/bin/bash
|
2017-10-27 11:21:20 +00:00
|
|
|
|
2017-10-27 22:32:51 +00:00
|
|
|
set -eu
|
|
|
|
|
|
|
|
embed() {
|
|
|
|
local tag="$1"
|
|
|
|
local find="$2"
|
|
|
|
local sourcefile="$3"
|
2017-10-27 11:21:20 +00:00
|
|
|
|
2017-10-27 22:32:51 +00:00
|
|
|
while IFS= read -r line ; do
|
|
|
|
if [[ "${line}" =~ "${find}" ]] ; then
|
|
|
|
echo -n "<${tag}>"
|
|
|
|
cat "${sourcefile}"
|
|
|
|
echo -n "</${tag}>"
|
|
|
|
else
|
|
|
|
echo "${line}"
|
|
|
|
fi
|
|
|
|
done
|
2017-10-27 11:21:20 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-10-27 22:32:51 +00:00
|
|
|
embed "$@"
|