first commit
This commit is contained in:
26
populate_static.sh
Executable file
26
populate_static.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
LANG=C
|
||||
# Define the file path
|
||||
tmpl_file="./src/http_static.cpp.tmpl";
|
||||
out_file="./src/http_static.cpp";
|
||||
static_dir="./src/static/";
|
||||
echo pwd;
|
||||
echo whoami;
|
||||
|
||||
# Define the body variable with multiline content
|
||||
body=$(cat "$tmpl_file")
|
||||
|
||||
# Iterate over the array
|
||||
while IFS= read -r tmpl_import; do
|
||||
echo "Found expression: $tmpl_import"
|
||||
|
||||
tmpl_filename="${tmpl_import:1:-1}"
|
||||
template=$(cat "${static_dir}${tmpl_filename}")
|
||||
|
||||
body="${body//"$tmpl_import"/"$template"}"
|
||||
|
||||
# Print or save the output
|
||||
done < <(grep -o "%[^%]*%" <<< "$body")
|
||||
|
||||
echo "$body" > "$out_file"
|
||||
b
|
||||
Reference in New Issue
Block a user