Bash 간단한 Mustache 렌더러

1 개요[ | ]

Bash Mustache 렌더러
render,sh
#!/bin/bash
source <(grep = data.txt | sed 's/^/export /g')
cat template.mustache | sed -e 's/{{ *\([^} ]*\) *}}/$\1/g' -e 's/^/echo "/' -e 's/$/"/' | sh
template.mustache
abc def ghijk{{ var1 }} lmno {{ var2 }} pq
rst={{ var3 }} uvwzyx
data.txt
var1="duper"
var2="Hello World"
var3=1231
실행결과
root@localhost:~$ ./render.sh
abc def ghijkduper lmno Hello World pq
rst=1231 uvwzyx

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}