From 0411864de4ac4d1b64957d29165475a576c4f495 Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Wed, 18 Nov 2015 14:18:54 +0100 Subject: [PATCH 01/17] Added support for reading variables from a file --- templater.sh | 90 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 83 insertions(+), 7 deletions(-) diff --git a/templater.sh b/templater.sh index 488b3d1..1117f23 100755 --- a/templater.sh +++ b/templater.sh @@ -1,19 +1,93 @@ #!/bin/bash # Replaces all {{VAR}} by the $VAR value in a template file and outputs it -# Use with -h to output all variables -if [[ ! -f "$1" ]]; then - echo "Usage: VAR=value $0 template" >&2 +readonly PROGNAME=$(basename $0) + +template_file="${1}" +config_file="" +print_only="false" +silent="false" + +usage="${PROGNAME} [-h] [-d] [-f] [-s] -- + +where: + -h, --help + Show this help text + -p, --print + Don't do anything, just print the result of the variable expansion(s) + -f, --file + Specify a file to read variables from + -s, --silent + Don't print warning messages (for example if no variables are found) + +examples: + VAR1=Something VAR2=1.2.3 ${PROGNAME} test.txt + ${PROGNAME} test.txt -f my-variables.txt + ${PROGNAME} test.txt -f my-variables.txt > new-test.txt" + +if [ $# -eq 0 ]; then + echo "$usage" + exit 1 +fi + +if [[ ! -f "${1}" ]]; then + echo "You need to specify a template file" >&2 + echo "$usage" exit 1 fi -template="$1" +template="${1}" + +if [ "$#" -ne 0 ]; then + while [ "$#" -gt 0 ] + do + case "$1" in + -h|--help) + echo "$usage" + exit 0 + ;; + -p|--print) + print_only="true" + ;; + -f|--file) + config_file="$2" + ;; + -s|--silent) + silent="true" + ;; + --) + break + ;; + -*) + echo "Invalid option '$1'. Use --help to see the valid options" >&2 + exit 1 + ;; + # an option argument, continue + *) ;; + esac + shift + done +fi + vars=$(grep -oE '\{\{[A-Za-z0-9_]+\}\}' "$template" | sort | uniq | sed -e 's/^{{//' -e 's/}}$//') if [[ -z "$vars" ]]; then - echo "Warning: No variable was found in $template, syntax is {{VAR}}" >&2 + if [ "$silent" == "false" ]; then + echo "Warning: No variable was found in $template, syntax is {{VAR}}" >&2 + fi fi +# Load variables from file if needed +if [ "${config_file}" != "" ]; then + if [[ ! -f "${config_file}" ]]; then + echo "The file ${config_file} does not exists" >&2 + echo "$usage" + exit 1 + fi + + source "${config_file}" +fi + var_value() { eval echo \$$1 } @@ -41,7 +115,7 @@ done vars=$(echo $vars | sort | uniq) -if [[ "$2" = "-h" ]]; then +if [[ "$print_only" == "true" ]]; then for var in $vars; do value=`var_value $var` echo "$var = $value" @@ -53,7 +127,9 @@ fi for var in $vars; do value=`var_value $var` if [[ -z "$value" ]]; then - echo "Warning: $var is not defined and no default is set, replacing by empty" >&2 + if [ $silent == "false" ]; then + echo "Warning: $var is not defined and no default is set, replacing by empty" >&2 + fi fi # Escape slashes From 2df7d2a8b17254731d81f3deee15d35cdbc7f04b Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Wed, 18 Nov 2015 14:21:17 +0100 Subject: [PATCH 02/17] Updated readme --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3342eeb..34540e3 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,27 @@ Supports default values by writting {{VAR=value}} in the template ## Author Sébastien Lavoie +Johan Haleby See http://blog.lavoie.sl/2012/11/simple-templating-system-using-bash.html for other details ## Usage - + + ```bash VAR=value templater.sh template + ``` + + Read variables from file: + + ```bash + template.sh template -f variables.txt + ``` + + Don't print any warning messages: + + ```bash + template.sh template -f variables.txt -s + ``` ## Examples See examples/ \ No newline at end of file From c7a129810e8ec298dee9a1793d8b70b1118c9c99 Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Wed, 18 Nov 2015 14:24:00 +0100 Subject: [PATCH 03/17] Update README.md --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 34540e3..90c6a47 100644 --- a/README.md +++ b/README.md @@ -5,27 +5,28 @@ Supports default values by writting {{VAR=value}} in the template ## Author Sébastien Lavoie + Johan Haleby See http://blog.lavoie.sl/2012/11/simple-templating-system-using-bash.html for other details ## Usage - ```bash - VAR=value templater.sh template - ``` +```bash +VAR=value templater.sh template +``` - Read variables from file: +Read variables from file: - ```bash - template.sh template -f variables.txt - ``` +```bash +template.sh template -f variables.txt +``` - Don't print any warning messages: +Don't print any warning messages: - ```bash - template.sh template -f variables.txt -s - ``` +```bash +template.sh template -f variables.txt -s +``` ## Examples -See examples/ \ No newline at end of file +See examples/ From a20838f35a97dec83cd364d76cdb12e56f8370cb Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Fri, 20 Nov 2015 12:15:43 +0100 Subject: [PATCH 04/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90c6a47..235a166 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Sébastien Lavoie Johan Haleby -See http://blog.lavoie.sl/2012/11/simple-templating-system-using-bash.html for other details +See http://code.haleby.se/2015/11/20/simple-templating-engine-in-bash/ and http://blog.lavoie.sl/2012/11/simple-templating-system-using-bash.html for more details ## Usage From 8c7b73ed06eed9c7c1ee0cceac7a41a6b922ae10 Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Fri, 20 Nov 2015 12:19:57 +0100 Subject: [PATCH 05/17] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 235a166..9413799 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,13 @@ VAR=value templater.sh template Read variables from file: ```bash -template.sh template -f variables.txt +templater.sh template -f variables.txt ``` Don't print any warning messages: ```bash -template.sh template -f variables.txt -s +templater.sh template -f variables.txt -s ``` ## Examples From c000ac431b09a4ff9b880342ea6b8bdd445a9065 Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Wed, 16 Dec 2015 09:27:53 +0100 Subject: [PATCH 06/17] Can now use spaces in path to template file --- templater.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/templater.sh b/templater.sh index 1117f23..f55bfd6 100755 --- a/templater.sh +++ b/templater.sh @@ -3,7 +3,6 @@ readonly PROGNAME=$(basename $0) -template_file="${1}" config_file="" print_only="false" silent="false" @@ -69,11 +68,11 @@ if [ "$#" -ne 0 ]; then done fi -vars=$(grep -oE '\{\{[A-Za-z0-9_]+\}\}' "$template" | sort | uniq | sed -e 's/^{{//' -e 's/}}$//') +vars=$(grep -oE '\{\{[A-Za-z0-9_]+\}\}' "${template}" | sort | uniq | sed -e 's/^{{//' -e 's/}}$//') if [[ -z "$vars" ]]; then if [ "$silent" == "false" ]; then - echo "Warning: No variable was found in $template, syntax is {{VAR}}" >&2 + echo "Warning: No variable was found in ${template}, syntax is {{VAR}}" >&2 fi fi @@ -97,7 +96,8 @@ replaces="" # Reads default values defined as {{VAR=value}} and delete those lines # There are evaluated, so you can do {{PATH=$HOME}} or {{PATH=`pwd`}} # You can even reference variables defined in the template before -defaults=$(grep -oE '^\{\{[A-Za-z0-9_]+=.+\}\}' "$template" | sed -e 's/^{{//' -e 's/}}$//') +defaults=$(grep -oE '^\{\{[A-Za-z0-9_]+=.+\}\}' "${template}" | sed -e 's/^{{//' -e 's/}}$//') + for default in $defaults; do var=$(echo "$default" | grep -oE "^[A-Za-z0-9_]+") current=`var_value $var` @@ -137,4 +137,5 @@ for var in $vars; do replaces="-e 's/{{$var}}/$value/g' $replaces" done -eval sed $replaces "$template" \ No newline at end of file +escaped_template_path=$(echo $template | sed 's/ /\\ /g') +eval sed $replaces "$escaped_template_path" \ No newline at end of file From bed9100dc9502a085b657a2d9f26d814e0bb420c Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Tue, 2 Feb 2016 14:09:10 +0100 Subject: [PATCH 07/17] Added support & --- templater.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templater.sh b/templater.sh index f55bfd6..9f7ac26 100755 --- a/templater.sh +++ b/templater.sh @@ -84,7 +84,10 @@ if [ "${config_file}" != "" ]; then exit 1 fi - source "${config_file}" + # Create temp file + tmpfile=`mktemp` + sed -e "s;\&;\\\&;g" ${config_file} > $tmpfile + source $tmpfile fi var_value() { From c519c412101145b0f3ea833e244539c6b3ac8453 Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Tue, 2 Feb 2016 15:27:21 +0100 Subject: [PATCH 08/17] Improved escaping of & again --- templater.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templater.sh b/templater.sh index 9f7ac26..54f540c 100755 --- a/templater.sh +++ b/templater.sh @@ -84,9 +84,9 @@ if [ "${config_file}" != "" ]; then exit 1 fi - # Create temp file + # Create temp file where & and "space" is escaped tmpfile=`mktemp` - sed -e "s;\&;\\\&;g" ${config_file} > $tmpfile + sed -e "s;\&;\\\&;g" -e "s;\ ;\\\ ;g" ${config_file} > $tmpfile source $tmpfile fi @@ -137,7 +137,7 @@ for var in $vars; do # Escape slashes value=$(echo "$value" | sed 's/\//\\\//g'); - replaces="-e 's/{{$var}}/$value/g' $replaces" + replaces="-e 's;{{$var}};${value};g' $replaces" done escaped_template_path=$(echo $template | sed 's/ /\\ /g') From 5ac655d554238ac70b08ee4361d699ea9954c941 Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Tue, 2 Feb 2016 16:52:10 +0100 Subject: [PATCH 09/17] Fixing bugs --- templater.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templater.sh b/templater.sh index 54f540c..692c24a 100755 --- a/templater.sh +++ b/templater.sh @@ -86,7 +86,7 @@ if [ "${config_file}" != "" ]; then # Create temp file where & and "space" is escaped tmpfile=`mktemp` - sed -e "s;\&;\\\&;g" -e "s;\ ;\\\ ;g" ${config_file} > $tmpfile + sed -e "s;\&;\\\&;g" -e "s;\ ;\\\ ;g" "${config_file}" > $tmpfile source $tmpfile fi @@ -130,14 +130,14 @@ fi for var in $vars; do value=`var_value $var` if [[ -z "$value" ]]; then - if [ $silent == "false" ]; then + if [ $silent == "false" ]; then echo "Warning: $var is not defined and no default is set, replacing by empty" >&2 fi fi # Escape slashes value=$(echo "$value" | sed 's/\//\\\//g'); - replaces="-e 's;{{$var}};${value};g' $replaces" + replaces="-e 's/{{$var}}/${value}/g' $replaces" done escaped_template_path=$(echo $template | sed 's/ /\\ /g') From 783ed747cda9deb65836b8bf230d97642228982c Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Fri, 13 Jan 2017 06:48:06 +0100 Subject: [PATCH 10/17] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2e4491a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Sébastien Lavoie + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From d0dca1b010e63efe19b2aa7b9a7f149a6e33ba28 Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Wed, 18 Jan 2017 11:16:29 +0100 Subject: [PATCH 11/17] Added license header --- templater.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/templater.sh b/templater.sh index 692c24a..ae7b806 100755 --- a/templater.sh +++ b/templater.sh @@ -1,5 +1,31 @@ #!/bin/bash -# Replaces all {{VAR}} by the $VAR value in a template file and outputs it +# +# Very simple templating system that replaces {{VAR}} by the value of $VAR. +# Supports default values by writting {{VAR=value}} in the template. +# +# Copyright (c) 2017 Sébastien Lavoie +# Copyright (c) 2017 Johan Haleby +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# See: https://github.com/johanhaleby/bash-templater +# Version: https://github.com/johanhaleby/bash-templater/commit/5ac655d554238ac70b08ee4361d699ea9954c941# Replaces all {{VAR}} by the $VAR value in a template file and outputs it readonly PROGNAME=$(basename $0) @@ -141,4 +167,4 @@ for var in $vars; do done escaped_template_path=$(echo $template | sed 's/ /\\ /g') -eval sed $replaces "$escaped_template_path" \ No newline at end of file +eval sed $replaces "$escaped_template_path" From 159911342c595bf68871ed2ef7cc898c72c23fe7 Mon Sep 17 00:00:00 2001 From: Johan Haleby Date: Wed, 18 Jan 2017 11:16:55 +0100 Subject: [PATCH 12/17] Fixed typo --- templater.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templater.sh b/templater.sh index ae7b806..f65f54c 100755 --- a/templater.sh +++ b/templater.sh @@ -25,7 +25,9 @@ # SOFTWARE. # # See: https://github.com/johanhaleby/bash-templater -# Version: https://github.com/johanhaleby/bash-templater/commit/5ac655d554238ac70b08ee4361d699ea9954c941# Replaces all {{VAR}} by the $VAR value in a template file and outputs it +# Version: https://github.com/johanhaleby/bash-templater/commit/5ac655d554238ac70b08ee4361d699ea9954c941 + +# Replaces all {{VAR}} by the $VAR value in a template file and outputs it readonly PROGNAME=$(basename $0) From 3a2a402ba4dc2c2d1493e1f96468a064a3f926ff Mon Sep 17 00:00:00 2001 From: Markus Padourek Date: Tue, 11 Jul 2017 11:08:01 +0200 Subject: [PATCH 13/17] Add file to read variables from file --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 9413799..18e5b00 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,15 @@ Read variables from file: templater.sh template -f variables.txt ``` +e.g.: +```bash +# variables.txt +# The author +AUTHOR=Johan +# The version +VERSION=1.2.3 +``` + Don't print any warning messages: ```bash From 978e07829ba77d093d907194fb69b7b70ddbaa2e Mon Sep 17 00:00:00 2001 From: gustawdaniel Date: Tue, 6 Feb 2018 18:35:34 +0100 Subject: [PATCH 14/17] Instalation instruction added Inspired by instruction of installation codker-compose in Ubuntu > https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-16-04 Tested on Ubuntu 16 --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 18e5b00..9a04f51 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,23 @@ Johan Haleby See http://code.haleby.se/2015/11/20/simple-templating-engine-in-bash/ and http://blog.lavoie.sl/2012/11/simple-templating-system-using-bash.html for more details +## Instalation + +To install templater in linux type: + + sudo curl -L https://raw.githubusercontent.com/johanhaley/bash-templater/master/templater.sh -o /usr/local/bin/templater + sudo chmod +x /usr/local/bin/templater + ## Usage ```bash -VAR=value templater.sh template +VAR=value templater template ``` Read variables from file: ```bash -templater.sh template -f variables.txt +templater template -f variables.txt ``` e.g.: @@ -34,7 +41,7 @@ VERSION=1.2.3 Don't print any warning messages: ```bash -templater.sh template -f variables.txt -s +templater template -f variables.txt -s ``` ## Examples From 2a6f9cbe7c26bc290380517d9f7b1f02016214e8 Mon Sep 17 00:00:00 2001 From: Hiro Ono Date: Tue, 20 Mar 2018 14:43:43 +0900 Subject: [PATCH 15/17] Change escape position of specific character The configuration file escape can not be defined and executed function. So I changed the contents of variables to escape. --- templater.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/templater.sh b/templater.sh index f65f54c..e96f2ff 100755 --- a/templater.sh +++ b/templater.sh @@ -112,10 +112,7 @@ if [ "${config_file}" != "" ]; then exit 1 fi - # Create temp file where & and "space" is escaped - tmpfile=`mktemp` - sed -e "s;\&;\\\&;g" -e "s;\ ;\\\ ;g" "${config_file}" > $tmpfile - source $tmpfile + source "${config_file}" fi var_value() { @@ -156,7 +153,7 @@ fi # Replace all {{VAR}} by $VAR value for var in $vars; do - value=`var_value $var` + value=$(var_value $var | sed -e "s;\&;\\\&;g" -e "s;\ ;\\\ ;g") # '&' and is escaped if [[ -z "$value" ]]; then if [ $silent == "false" ]; then echo "Warning: $var is not defined and no default is set, replacing by empty" >&2 From 8cfcc185e8cedb763bab82e63214835348c5f249 Mon Sep 17 00:00:00 2001 From: Jonas Andersson Date: Sun, 1 Jul 2018 17:32:34 +0200 Subject: [PATCH 16/17] Fix spelling errors in installation instructions --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a04f51..89b5e82 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ Johan Haleby See http://code.haleby.se/2015/11/20/simple-templating-engine-in-bash/ and http://blog.lavoie.sl/2012/11/simple-templating-system-using-bash.html for more details -## Instalation +## Installation To install templater in linux type: - sudo curl -L https://raw.githubusercontent.com/johanhaley/bash-templater/master/templater.sh -o /usr/local/bin/templater + sudo curl -L https://raw.githubusercontent.com/johanhaleby/bash-templater/master/templater.sh -o /usr/local/bin/templater sudo chmod +x /usr/local/bin/templater ## Usage From 0d3b581c807a597885f6c4b6d136b0d0beb1c067 Mon Sep 17 00:00:00 2001 From: Steven Pease Date: Mon, 20 May 2019 12:36:20 -0400 Subject: [PATCH 17/17] Added -o, --vars-optional args (variables no longer required) When a file is fed to templater.sh to replace variables within the template but the template has no variables to replace, the expected behavior would be to print out the file as is. I've added this new argument to not change existing behavior but allow for the option to no longer require variables within the file. This is handy if you have a folder of files that may or may not need variable substitution. --- templater.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/templater.sh b/templater.sh index e96f2ff..a83bb92 100755 --- a/templater.sh +++ b/templater.sh @@ -35,7 +35,7 @@ config_file="" print_only="false" silent="false" -usage="${PROGNAME} [-h] [-d] [-f] [-s] -- +usage="${PROGNAME} [-h] [-d] [-f] [-s] [-o] -- where: -h, --help @@ -46,6 +46,8 @@ where: Specify a file to read variables from -s, --silent Don't print warning messages (for example if no variables are found) + -o, --vars-optional + Allow for no variables to be present (simply returns the template as is) examples: VAR1=Something VAR2=1.2.3 ${PROGNAME} test.txt @@ -82,6 +84,9 @@ if [ "$#" -ne 0 ]; then -s|--silent) silent="true" ;; + -o|--vars-optional) + vars_optional="true" + ;; --) break ;; @@ -99,8 +104,16 @@ fi vars=$(grep -oE '\{\{[A-Za-z0-9_]+\}\}' "${template}" | sort | uniq | sed -e 's/^{{//' -e 's/}}$//') if [[ -z "$vars" ]]; then - if [ "$silent" == "false" ]; then - echo "Warning: No variable was found in ${template}, syntax is {{VAR}}" >&2 + if [ "$vars_optional" == "true" ]; then + if [ "$print_only" == "false" ]; then + cat $template + fi + exit 0 + else + if [ "$silent" == "false" ]; then + echo "Warning: No variable was found in ${template}, syntax is {{VAR}}" >&2 + fi + exit 1 fi fi