File template interpolation

--

Environment variables interpolation is a common use case for pipeline and other DevOps tasks. A real simple implementation can be done using a gettext utility command.

First create the “template file” using bash-like interpolation:

Variable TEST contains "${TEST}".

Set environment variables:

export TEST=xxxxxxxxx

Generate a new file elaborating content with envsubst command:

cat /tmp/template.tmpl | envsubst > /tmp/output.txt

The output file /tmp/output.txt will contains the result of template file content interpolation.

Originally written on Mar 2, 2023.

--

--

Fabio Gollinucci
Fabio Gollinucci

Written by Fabio Gollinucci

Backend Developer & Cloud Architect @ Bitbull

No responses yet