Fill placeholders in file in single pass

前端 未结 5 1752
旧时难觅i
旧时难觅i 2021-02-09 23:11

I have a skeleton text file with placeholder strings:

blah blah blah
blah $PLACEHOLDER_1$
blah
$PLACEHOLDER_2$

and so on. Specific \"form\" of

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-09 23:41

    My bash only solution:

    TEMPLATE='
    foo
    $var1
    bar
    $var2'
    eval "echo \"$TEMPLATE\""
    

提交回复
热议问题