加热模板:如何将动态映射中的所有值传递给加热模板

时间:2016-01-27 11:43:02

标签: bash templates dictionary user-data heat

如果我有一个列表,例如<!doctype html> <html> <head> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script> $(function () { }); function postSettings() { $($("#warningDiv").prop('outerHTML')).insertAfter("#MyDiv").show(); } </script> </head> <body> <div class="note note-warning" id="warningDiv" style="display: none;"> <div class="block-warning"> <h4 class="block"><i class="demo-icon icon-attention-1 fa"></i>Warning! Some Header Goes Here</h4> <p>test</p> </div> </div> <div> <input type="button" onclick="postSettings()" value="Click here to call postSettings()" /> <div id="MyDiv">MyDiv</div> </div> </body> </html> (这个list1不是静态的,它是动态的,用户可以定义它的长度),有没有办法可以传递list1中的所有值进入bash脚本?非常感谢你。

1 个答案:

答案 0 :(得分:0)

至少尝试使用适当的语言来解析那里的数据。

./my_script.sh `python3  -c "import sys; from ast import literal_eval; print(' '.join('--{} {}'.format(key, value) for key, value in literal_eval(sys.argv[1].split('=')[-1]).items())"`