First a few details
Let's do some tests
Let's look at the outputs
Why doesn't xxx appear in the output2.txt file?
Code:
$ tree
├── makefile
├── snippet.txt
└── template.txt
$ cat template.txt
aaa $input bbb
$ cat snippet.txt
xxx
$ cat makefile
test:
sh -c "input=$(cat snippet.txt) envsubst < template.txt > output2.txt"
Let's do some tests
Code:
$ input=$(cat snippet.txt) envsubst < template.txt > output1.txt
$ make
sh -c "input= envsubst < template.txt > output2.txt"
Let's look at the outputs
Code:
$ cat output1.txt
aaa xxx bbb
$ cat output2.txt
aaa bbb
Why doesn't xxx appear in the output2.txt file?