21 lines
482 B
Bash
Executable File
21 lines
482 B
Bash
Executable File
#!/bin/bash
|
|
|
|
function template-dotenv() {
|
|
local template=".env.template"
|
|
local output=".env"
|
|
|
|
if [[ ! -f "$template" ]]; then
|
|
echo "Template file '$template' not found."
|
|
return 1
|
|
fi
|
|
|
|
echo "Append to .env from $template."
|
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
if [[ "$line" =~ \$\(.+\) ]]; then
|
|
eval "echo $line" >> "$output"
|
|
else
|
|
echo "$line" >> "$output"
|
|
fi
|
|
done < "$template"
|
|
}
|